fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [13507] Syncromind: Merge 13482:13506 from trunk


From: Sigurd Nes
Subject: [Fmsystem-commits] [13507] Syncromind: Merge 13482:13506 from trunk
Date: Thu, 25 Jun 2015 11:31:12 +0000

Revision: 13507
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=13507
Author:   sigurdne
Date:     2015-06-25 11:31:11 +0000 (Thu, 25 Jun 2015)
Log Message:
-----------
Syncromind: Merge 13482:13506 from trunk

Modified Paths:
--------------
    branches/dev-syncromind/rental/inc/class.socommon.inc.php
    branches/dev-syncromind/rental/inc/class.socontract_price_item.inc.php
    branches/dev-syncromind/rental/inc/model/class.contract_price_item.inc.php
    branches/dev-syncromind/rental/setup/phpgw_no.lang
    branches/dev-syncromind/rental/templates/base/price_item_partial.php

Property Changed:
----------------
    branches/dev-syncromind/


Property changes on: branches/dev-syncromind
___________________________________________________________________
Modified: svn:mergeinfo
   - /branches/stavangerkommune:12743-12875,12986
/trunk:12111-12211,12213-12246,12250-12363,12366-12405,12407-12435,12437-12462,12464-12527,12530-12602,12604-12670,12672-12683,12686-12750,12753-12785,12787-12974,12987,12989-13177,13179-13344,13346-13399,13401-13432,13434-13481
   + /branches/stavangerkommune:12743-12875,12986
/trunk:12111-12211,12213-12246,12250-12363,12366-12405,12407-12435,12437-12462,12464-12527,12530-12602,12604-12670,12672-12683,12686-12750,12753-12785,12787-12974,12987,12989-13177,13179-13344,13346-13399,13401-13432,13434-13481,13483-13506

Modified: branches/dev-syncromind/rental/inc/class.socommon.inc.php
===================================================================
--- branches/dev-syncromind/rental/inc/class.socommon.inc.php   2015-06-25 
11:27:28 UTC (rev 13506)
+++ branches/dev-syncromind/rental/inc/class.socommon.inc.php   2015-06-25 
11:31:11 UTC (rev 13507)
@@ -213,6 +213,35 @@
 
                $sql = $this->get_query($sort_field, $ascending, $search_for, 
$search_type, $filters, false);
                $sql_parts = explode('1=1',$sql); // Split the query to insert 
extra condition on test for break
+
+               /**
+                * Sigurd: try to limit the candidates to a minimum
+                */
+               $bypass_offset_check = false;
+               if($num_of_objects && isset($id_field_name_info['translated']))
+               {
+                       $bypass_offset_check = true;
+                       $sql_parts_filter = explode('FROM',$sql);
+
+                       $sql_filter = "SELECT DISTINCT 
{$id_field_name_info['table']}.{$id_field_name_info['field']} AS 
{$id_field_name_info['translated']}";
+                       if($sort_field && $sort_field != 
$id_field_name_info['translated'])
+                       {
+                               $sql_filter .= ",{$sort_field}";
+                       }
+
+                       $sql_filter .= " FROM {$sql_parts_filter[1]}";
+
+                       $this->db->limit_query($sql_filter, $start_index, 
__LINE__, __FILE__, (int)$num_of_objects);
+                       $ids = array();
+                       while ($this->db->next_record())
+                       {
+                               $ids[] = 
$this->db->f($id_field_name_info['translated']);
+                       }
+                       $id_filter = 
"{$id_field_name_info['table']}.{$id_field_name_info['field']} IN(" . 
implode(',', $ids) . ') ';
+
+                       $sql = str_replace('1=1', $id_filter, $sql);
+               }
+
                $this->db->query($sql,__LINE__, __FILE__, false, true);
 
                while ($this->db->next_record()) // Runs through all of the 
results
@@ -230,7 +259,7 @@
                                        $object_ids[] = $result_id; // We have 
to add the new id
                                }
                                // We have to check if we should populate this 
object
-                               if(count($object_ids) > $start_index) // We're 
at index above start index
+                               if($bypass_offset_check || ( count($object_ids) 
> $start_index) ) // We're at index above start index
                                {
                                        if($num_of_objects == null || 
count($results) < $num_of_objects) // We haven't found all the objects we're 
looking for
                                        {
@@ -348,5 +377,4 @@
                // The object did not validate
                return false;
        }
-}
-?>
+}
\ No newline at end of file

Modified: branches/dev-syncromind/rental/inc/class.socontract_price_item.inc.php
===================================================================
--- branches/dev-syncromind/rental/inc/class.socontract_price_item.inc.php      
2015-06-25 11:27:28 UTC (rev 13506)
+++ branches/dev-syncromind/rental/inc/class.socontract_price_item.inc.php      
2015-06-25 11:31:11 UTC (rev 13507)
@@ -97,20 +97,25 @@
                
                if($return_count) // We should only return a count
                {
-                       $cols = 'COUNT(DISTINCT(id)) AS count';
+                       $cols = 'COUNT(DISTINCT(rental_contract_price_item.id)) 
AS count';
                        $order = "";
                }
                else if(isset($filters['export']))
                {
-                       $cols = 'id, price_item_id, contract_id, area, count, 
agresso_id, title, is_area, price, total_price, is_one_time, date_start, 
date_end';
+                       $cols = "rental_contract_price_item.id, 
rental_contract_price_item.price_item_id,"
+                       . " rental_contract_price_item.contract_id, 
rental_contract_price_item.area, rental_contract_price_item.count,"
+                       . " rental_contract_price_item.agresso_id, 
rental_contract_price_item.title, rental_contract_price_item.is_area,"
+                       . " rental_contract_price_item.price, 
rental_contract_price_item.total_price, rental_contract_price_item.is_one_time,"
+                       . " rental_contract_price_item.date_start, 
rental_contract_price_item.date_end";
                }
                else
                {
-                       $cols = '*';
+                       $cols = 'rental_contract_price_item.*, 
rental_price_item.type';
                }
                
                $tables = "rental_contract_price_item";
-               $joins = "";
+//             $joins = "";
+               $joins = "{$this->join} rental_price_item ON 
(rental_price_item.id = rental_contract_price_item.price_item_id)";
 
                //var_dump("SELECT {$cols} FROM {$tables} {$joins} WHERE 
{$condition} {$order}");
                return "SELECT {$cols} FROM {$tables} {$joins} WHERE 
{$condition} {$order}";
@@ -134,6 +139,9 @@
                        
$price_item->set_total_price($this->unmarshal($this->db->f('total_price'),'float'));
                        
$price_item->set_date_start($this->unmarshal($this->db->f('date_start'),'int'));
                        
$price_item->set_date_end($this->unmarshal($this->db->f('date_end'),'int'));
+                       $price_type_id  = (int)$this->db->f('type');
+                       $price_item->set_price_type_id($price_type_id);
+                       $price_item->set_price_type_title($price_type_id);
                }
                return $price_item;
        }

Modified: 
branches/dev-syncromind/rental/inc/model/class.contract_price_item.inc.php
===================================================================
--- branches/dev-syncromind/rental/inc/model/class.contract_price_item.inc.php  
2015-06-25 11:27:28 UTC (rev 13506)
+++ branches/dev-syncromind/rental/inc/model/class.contract_price_item.inc.php  
2015-06-25 11:31:11 UTC (rev 13507)
@@ -201,7 +201,8 @@
                                // in "date" parser which requires a format 
like: 2009/07/30 to work. 
                                // EHL: Removed 2009-10-27, due to change to 
int datatype. 
                                'date_start' => 
$this->get_date_start()!=NULL?date($date_format, $this->get_date_start()):null, 
 
-                               'date_end' => 
$this->get_date_end()!=NULL?date($date_format, $this->get_date_end()):null
+                               'date_end' => 
$this->get_date_end()!=NULL?date($date_format, $this->get_date_end()):null,
+                               'price_type_title' => 
lang($this->get_price_type_title()),
                        );
                }
                

Modified: branches/dev-syncromind/rental/setup/phpgw_no.lang
===================================================================
--- branches/dev-syncromind/rental/setup/phpgw_no.lang  2015-06-25 11:27:28 UTC 
(rev 13506)
+++ branches/dev-syncromind/rental/setup/phpgw_no.lang  2015-06-25 11:31:11 UTC 
(rev 13507)
@@ -1,3 +1,5 @@
+day    rental  no      Dag
+hour   rental  no      Time
 1-6 characters rental  no      1-6 tegn
 6 characters   rental  no      6 tegn
 account_in     rental  no      Art/konto inntektsside

Modified: branches/dev-syncromind/rental/templates/base/price_item_partial.php
===================================================================
--- branches/dev-syncromind/rental/templates/base/price_item_partial.php        
2015-06-25 11:27:28 UTC (rev 13506)
+++ branches/dev-syncromind/rental/templates/base/price_item_partial.php        
2015-06-25 11:31:11 UTC (rev 13507)
@@ -79,6 +79,11 @@
                        sortable: true
                },
                {
+                       key: "price_type_title",
+                       label: "<?php echo lang('type') ?>",
+                       sortable: false
+               },
+               {
                        key: "id",
                        hidden: true
                },




reply via email to

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