fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [11379] frontend: try to ease the workload to find da


From: Sigurd Nes
Subject: [Fmsystem-commits] [11379] frontend: try to ease the workload to find data
Date: Fri, 18 Oct 2013 09:28:41 +0000

Revision: 11379
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=11379
Author:   sigurdne
Date:     2013-10-18 09:28:41 +0000 (Fri, 18 Oct 2013)
Log Message:
-----------
frontend: try to ease the workload to find data

Modified Paths:
--------------
    trunk/frontend/inc/class.bofellesdata.inc.php
    trunk/frontend/inc/class.borental.inc.php
    trunk/frontend/inc/class.sorental.inc.php
    trunk/frontend/inc/class.uicontract_ex.inc.php
    trunk/frontend/inc/class.uifrontend.inc.php
    trunk/frontend/templates/base/frontend.xsl
    trunk/rental/inc/class.bofellesdata.inc.php
    trunk/rental/inc/class.socontract.inc.php
    trunk/rental/inc/class.soparty.inc.php
    trunk/rental/inc/class.sounit.inc.php
    trunk/rental/inc/model/class.contract.inc.php

Modified: trunk/frontend/inc/class.bofellesdata.inc.php
===================================================================
--- trunk/frontend/inc/class.bofellesdata.inc.php       2013-10-18 08:26:49 UTC 
(rev 11378)
+++ trunk/frontend/inc/class.bofellesdata.inc.php       2013-10-18 09:28:41 UTC 
(rev 11379)
@@ -1,6 +1,31 @@
 <?php
-    class frontend_bofellesdata {
+       /**
+        * Frontend : a simplified tool for end users.
+        *
+        * @copyright Copyright (C) 2010 Free Software Foundation, Inc. 
http://www.fsf.org/
+        * @license http://www.gnu.org/licenses/gpl.html GNU General Public 
License
+        * @package Frontend
+        * @version $Id$
+        */
 
+       /*
+          This program is free software: you can redistribute it and/or modify
+          it under the terms of the GNU General Public License as published by
+          the Free Software Foundation, either version 2 of the License, or
+          (at your option) any later version.
+
+          This program is distributed in the hope that it will be useful,
+          but WITHOUT ANY WARRANTY; without even the implied warranty of
+          MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+          GNU General Public License for more details.
+
+          You should have received a copy of the GNU General Public License
+          along with this program.  If not, see <http://www.gnu.org/licenses/>.
+       */
+
+    class frontend_bofellesdata
+    {
+
        // Instance variable
            protected static $bo;
 

Modified: trunk/frontend/inc/class.borental.inc.php
===================================================================
--- trunk/frontend/inc/class.borental.inc.php   2013-10-18 08:26:49 UTC (rev 
11378)
+++ trunk/frontend/inc/class.borental.inc.php   2013-10-18 09:28:41 UTC (rev 
11379)
@@ -1,4 +1,29 @@
 <?php
+       /**
+        * Frontend : a simplified tool for end users.
+        *
+        * @author Sigurd Nes <address@hidden>
+        * @copyright Copyright (C) 2013 Free Software Foundation, Inc. 
http://www.fsf.org/
+        * @license http://www.gnu.org/licenses/gpl.html GNU General Public 
License
+        * @package Frontend
+        * @version $Id$
+        */
+
+       /*
+          This program is free software: you can redistribute it and/or modify
+          it under the terms of the GNU General Public License as published by
+          the Free Software Foundation, either version 2 of the License, or
+          (at your option) any later version.
+
+          This program is distributed in the hope that it will be useful,
+          but WITHOUT ANY WARRANTY; without even the implied warranty of
+          MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+          GNU General Public License for more details.
+
+          You should have received a copy of the GNU General Public License
+          along with this program.  If not, see <http://www.gnu.org/licenses/>.
+       */
+
        phpgw::import_class('rental.soparty');
        phpgw::import_class('rental.socontract');
        phpgw::import_class('rental.socomposite');
@@ -328,10 +353,10 @@
                        }
 
                        $all_unit_ids = array_unique($bofellesdata->unit_ids);
+
  
                        $parties        = 
execMethod('frontend.sorental.get_parties', $all_unit_ids);
 
-
                        return $parties;
                }
 

Modified: trunk/frontend/inc/class.sorental.inc.php
===================================================================
--- trunk/frontend/inc/class.sorental.inc.php   2013-10-18 08:26:49 UTC (rev 
11378)
+++ trunk/frontend/inc/class.sorental.inc.php   2013-10-18 09:28:41 UTC (rev 
11379)
@@ -122,60 +122,38 @@
                        . " {$this->_db->join} rental_unit ON 
(rental_composite.id = rental_unit.composite_id)"
                        . " {$filtermethod}";
 
-
+//_debug_array($sql);
                        $this->_db->query($sql,__LINE__,__FILE__);
 
                        $values = array();
+                       $level = 0;
+                       $map_level = array();
                        while ($this->_db->next_record())
                        {
-                               $values[] = array
-                               (
-                                       'location_code'         => 
$this->_db->f('location_code', true),
-                               );
+                               $location_code  = 
$this->_db->f('location_code', true);
+                               
+                               $_level = substr_count($location_code, '-') + 1;
+                               
+                               $level = $_level > $level ? $_level : $level;
+                               
+                               $map_level[$level][] = $location_code;
                        }
                        
-                       foreach ($values as &$entry)
+                       foreach ($map_level as $level => $locations)
                        {
-
-                               $location_code = $entry['location_code'];
-                               // We get the data from the property module
-                               $data = 
execMethod('property.bolocation.read_single', array('location_code' => 
$location_code, 'extra' => array('view' => true)));
-
-                               $stop_search = false;
-                               for($i = 1; !$stop_search; $i++)
+                       
+                               $sql = "SELECT loc{$level}_name as name, 
location_code FROM fm_location{$level} WHERE location_code IN ('" . 
implode("','", $locations) . "')";
+                               $this->_db->query($sql,__LINE__,__FILE__);
+                               while ($this->_db->next_record())
                                {
-                                       $loc_name = "loc{$i}_name";
-                                       if(array_key_exists($loc_name, $data))
-                                       {
-                                               $entry[$loc_name] =  
$data[$loc_name];
-                                       }
-                                       else
-                                       {
-                                               $stop_search = true;
-                                       }
+                                       $values[] = array
+                                       (
+                                               'location_code' => 
$this->_db->f('location_code', true),
+                                               'name'                  => 
$this->_db->f('name', true),
+                                       );
                                }
+                       }
 
-                               $entry['address'] = $data['street_name'].' 
'.$data['street_number'];
-                               foreach($data['attributes'] as $attributes)
-                               {
-                                       switch($attributes['column_name'])
-                                       {
-                                               case 'area_gross':
-                                                       $entry['area_gros'] = 
$attributes['value'];
-                                                       break;
-                                               case 'area_net':
-                                                       $entry['area_net'] = 
$attributes['value'];
-                                                       break;
-                                               case 'bruttoareal':
-                                                       $entry['area_gros'] = 
$attributes['value'];
-                                                       break;
-                                               case 'nettoareal':
-                                                       $entry['area_net'] = 
$attributes['value'];
-                                                       break;
-                                       }
-                               }
-                       } 
-
                        return $values;
                }
 
@@ -191,7 +169,7 @@
                        }
                        
                        $sql = 'SELECT id FROM rental_party WHERE org_enhet_id 
IN (' . implode(',', $org_units) . ')'; 
-_debug_array($sql);
+//_debug_array($sql);
                        $this->_db->query($sql,__LINE__,__FILE__);
 
                        $values = array();

Modified: trunk/frontend/inc/class.uicontract_ex.inc.php
===================================================================
--- trunk/frontend/inc/class.uicontract_ex.inc.php      2013-10-18 08:26:49 UTC 
(rev 11378)
+++ trunk/frontend/inc/class.uicontract_ex.inc.php      2013-10-18 09:28:41 UTC 
(rev 11379)
@@ -1,15 +1,38 @@
 <?php
+       /**
+        * Frontend : a simplified tool for end users.
+        *
+        * @copyright Copyright (C) 2010 Free Software Foundation, Inc. 
http://www.fsf.org/
+        * @license http://www.gnu.org/licenses/gpl.html GNU General Public 
License
+        * @package Frontend
+        * @version $Id$
+        */
 
-phpgw::import_class('frontend.uicontract');
+       /*
+          This program is free software: you can redistribute it and/or modify
+          it under the terms of the GNU General Public License as published by
+          the Free Software Foundation, either version 2 of the License, or
+          (at your option) any later version.
 
-class frontend_uicontract_ex extends frontend_uicontract
-{
-       public function __construct()
+          This program is distributed in the hope that it will be useful,
+          but WITHOUT ANY WARRANTY; without even the implied warranty of
+          MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+          GNU General Public License for more details.
+
+          You should have received a copy of the GNU General Public License
+          along with this program.  If not, see <http://www.gnu.org/licenses/>.
+       */
+
+       phpgw::import_class('frontend.uicontract');
+
+       class frontend_uicontract_ex extends frontend_uicontract
        {
-               $this->contract_state_identifier = "contract_state_ex";
-               $this->contracts_per_location_identifier = 
"contracts_ex_per_location";
-               $this->form_url = 
"index.php?menuaction=frontend.uicontract_ex.index";
-               
phpgwapi_cache::session_set('frontend','tab',$GLOBALS['phpgw']->locations->get_id('frontend','.rental.contract_ex'));
-               parent::__construct();
+               public function __construct()
+               {
+                       $this->contract_state_identifier = "contract_state_ex";
+                       $this->contracts_per_location_identifier = 
"contracts_ex_per_location";
+                       $this->form_url = 
"index.php?menuaction=frontend.uicontract_ex.index";
+                       
phpgwapi_cache::session_set('frontend','tab',$GLOBALS['phpgw']->locations->get_id('frontend','.rental.contract_ex'));
+                       parent::__construct();
+               }
        }
-}

Modified: trunk/frontend/inc/class.uifrontend.inc.php
===================================================================
--- trunk/frontend/inc/class.uifrontend.inc.php 2013-10-18 08:26:49 UTC (rev 
11378)
+++ trunk/frontend/inc/class.uifrontend.inc.php 2013-10-18 09:28:41 UTC (rev 
11379)
@@ -119,6 +119,7 @@
 
                                //Update locations according to organisational 
unit specification
                                $property_locations = 
frontend_borental::get_property_locations($org_unit_ids, 
$this->header_state['org_unit']);
+
                                $property_locations_update = true;
 
                        }

Modified: trunk/frontend/templates/base/frontend.xsl
===================================================================
--- trunk/frontend/templates/base/frontend.xsl  2013-10-18 08:26:49 UTC (rev 
11378)
+++ trunk/frontend/templates/base/frontend.xsl  2013-10-18 09:28:41 UTC (rev 
11379)
@@ -118,6 +118,7 @@
                                                                        <em 
class="select_header"><xsl:value-of select="php:function('lang', 
'select_unit')"/></em>
                                                                </label>
                                                                <br/>
+                                                               <xsl:variable 
name="lang_no_name_unit"><xsl:value-of select="php:function('lang', 
'no_name_unit')"/></xsl:variable>                                               
              
                                                                <select 
name="location" size="7" onchange="this.form.submit();" style="margin:5px;">
                                                                        
<xsl:for-each select="locations">
                                                                                
<xsl:sort select="loc1_name"/>
@@ -125,14 +126,11 @@
                                                                                
        <xsl:when test="location_code = //header/selected_location">
                                                                                
                <option value="{location_code}" selected="selected">
                                                                                
                        <xsl:choose>
-                                                                               
                                <xsl:when test="loc2_name != ''">
-                                                                               
                                        <xsl:value-of select="loc2_name"/>
+                                                                               
                                <xsl:when test="name != ''">
+                                                                               
                                        <xsl:value-of select="name"/>
                                                                                
                                </xsl:when>
-                                                                               
                                <xsl:when test="loc1_name != ''">
-                                                                               
                                        <xsl:value-of select="loc1_name"/>
-                                                                               
                                </xsl:when>
                                                                                
                                <xsl:otherwise>
-                                                                               
                                        <xsl:value-of 
select="php:function('lang', 'no_name_unit')"/> (<xsl:value-of 
select="location_code"/>)
+                                                                               
                                        <xsl:value-of 
select="$lang_no_name_unit"/> (<xsl:value-of select="location_code"/>)
                                                                                
                                </xsl:otherwise>
                                                                                
                        </xsl:choose>
                                                                                
                </option>
@@ -140,14 +138,11 @@
                                                                                
        <xsl:otherwise>
                                                                                
                <option value="{location_code}">
                                                                                
                <xsl:choose>
-                                                                               
                        <xsl:when test="loc2_name != ''">
-                                                                               
                                <xsl:value-of select="loc2_name"/>
+                                                                               
                        <xsl:when test="name != ''">
+                                                                               
                                <xsl:value-of select="name"/>
                                                                                
                        </xsl:when>
-                                                                               
                        <xsl:when test="loc1_name != ''">
-                                                                               
                                <xsl:value-of select="loc1_name"/>
-                                                                               
                        </xsl:when>
                                                                                
                        <xsl:otherwise>
-                                                                               
                                <xsl:value-of select="php:function('lang', 
'no_name_unit')"/> (<xsl:value-of select="location_code"/>)
+                                                                               
                                        <xsl:value-of 
select="$lang_no_name_unit"/> (<xsl:value-of select="location_code"/>)
                                                                                
                        </xsl:otherwise>
                                                                                
                </xsl:choose>
                                                                                
                </option>

Modified: trunk/rental/inc/class.bofellesdata.inc.php
===================================================================
--- trunk/rental/inc/class.bofellesdata.inc.php 2013-10-18 08:26:49 UTC (rev 
11378)
+++ trunk/rental/inc/class.bofellesdata.inc.php 2013-10-18 09:28:41 UTC (rev 
11379)
@@ -1,6 +1,30 @@
 <?php
-    class rental_bofellesdata
-    {
+       /**
+        * Frontend : a simplified tool for end users.
+        *
+        * @copyright Copyright (C) 2010 Free Software Foundation, Inc. 
http://www.fsf.org/
+        * @license http://www.gnu.org/licenses/gpl.html GNU General Public 
License
+        * @package Frontend
+        * @version $Id$
+        */
+
+       /*
+          This program is free software: you can redistribute it and/or modify
+          it under the terms of the GNU General Public License as published by
+          the Free Software Foundation, either version 2 of the License, or
+          (at your option) any later version.
+
+          This program is distributed in the hope that it will be useful,
+          but WITHOUT ANY WARRANTY; without even the implied warranty of
+          MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+          GNU General Public License for more details.
+
+          You should have received a copy of the GNU General Public License
+          along with this program.  If not, see <http://www.gnu.org/licenses/>.
+       */
+
+       class rental_bofellesdata
+       {
        // Instance variable
                protected static $bo;
                protected $connected = false;

Modified: trunk/rental/inc/class.socontract.inc.php
===================================================================
--- trunk/rental/inc/class.socontract.inc.php   2013-10-18 08:26:49 UTC (rev 
11378)
+++ trunk/rental/inc/class.socontract.inc.php   2013-10-18 09:28:41 UTC (rev 
11379)
@@ -1,4 +1,28 @@
 <?php
+       /**
+        * Frontend : a simplified tool for end users.
+        *
+        * @copyright Copyright (C) 2010 Free Software Foundation, Inc. 
http://www.fsf.org/
+        * @license http://www.gnu.org/licenses/gpl.html GNU General Public 
License
+        * @package Frontend
+        * @version $Id$
+        */
+
+       /*
+          This program is free software: you can redistribute it and/or modify
+          it under the terms of the GNU General Public License as published by
+          the Free Software Foundation, either version 2 of the License, or
+          (at your option) any later version.
+
+          This program is distributed in the hope that it will be useful,
+          but WITHOUT ANY WARRANTY; without even the implied warranty of
+          MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+          GNU General Public License for more details.
+
+          You should have received a copy of the GNU General Public License
+          along with this program.  If not, see <http://www.gnu.org/licenses/>.
+       */
+
 phpgw::import_class('rental.socommon');
 
 include_class('rental', 'contract_date', 'inc/model/');

Modified: trunk/rental/inc/class.soparty.inc.php
===================================================================
--- trunk/rental/inc/class.soparty.inc.php      2013-10-18 08:26:49 UTC (rev 
11378)
+++ trunk/rental/inc/class.soparty.inc.php      2013-10-18 09:28:41 UTC (rev 
11379)
@@ -1,5 +1,28 @@
 <?php
+       /**
+        * Frontend : a simplified tool for end users.
+        *
+        * @copyright Copyright (C) 2010 Free Software Foundation, Inc. 
http://www.fsf.org/
+        * @license http://www.gnu.org/licenses/gpl.html GNU General Public 
License
+        * @package Frontend
+        * @version $Id$
+        */
 
+       /*
+          This program is free software: you can redistribute it and/or modify
+          it under the terms of the GNU General Public License as published by
+          the Free Software Foundation, either version 2 of the License, or
+          (at your option) any later version.
+
+          This program is distributed in the hope that it will be useful,
+          but WITHOUT ANY WARRANTY; without even the implied warranty of
+          MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+          GNU General Public License for more details.
+
+          You should have received a copy of the GNU General Public License
+          along with this program.  If not, see <http://www.gnu.org/licenses/>.
+       */
+
 phpgw::import_class('rental.socommon');
 phpgw::import_class('rental.bofellesdata');
 

Modified: trunk/rental/inc/class.sounit.inc.php
===================================================================
--- trunk/rental/inc/class.sounit.inc.php       2013-10-18 08:26:49 UTC (rev 
11378)
+++ trunk/rental/inc/class.sounit.inc.php       2013-10-18 09:28:41 UTC (rev 
11379)
@@ -1,4 +1,29 @@
 <?php
+       /**
+        * Frontend : a simplified tool for end users.
+        *
+        * @author Sigurd Nes <address@hidden>
+        * @copyright Copyright (C) 2010 Free Software Foundation, Inc. 
http://www.fsf.org/
+        * @license http://www.gnu.org/licenses/gpl.html GNU General Public 
License
+        * @package Frontend
+        * @version $Id$
+        */
+
+       /*
+          This program is free software: you can redistribute it and/or modify
+          it under the terms of the GNU General Public License as published by
+          the Free Software Foundation, either version 2 of the License, or
+          (at your option) any later version.
+
+          This program is distributed in the hope that it will be useful,
+          but WITHOUT ANY WARRANTY; without even the implied warranty of
+          MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+          GNU General Public License for more details.
+
+          You should have received a copy of the GNU General Public License
+          along with this program.  If not, see <http://www.gnu.org/licenses/>.
+       */
+
 phpgw::import_class('rental.socommon');
 phpgw::import_class('rental.uicommon');
 

Modified: trunk/rental/inc/model/class.contract.inc.php
===================================================================
--- trunk/rental/inc/model/class.contract.inc.php       2013-10-18 08:26:49 UTC 
(rev 11378)
+++ trunk/rental/inc/model/class.contract.inc.php       2013-10-18 09:28:41 UTC 
(rev 11379)
@@ -1,5 +1,28 @@
 <?php
+       /**
+        * Frontend : a simplified tool for end users.
+        *
+        * @copyright Copyright (C) 2010 Free Software Foundation, Inc. 
http://www.fsf.org/
+        * @license http://www.gnu.org/licenses/gpl.html GNU General Public 
License
+        * @package Frontend
+        * @version $Id$
+        */
 
+       /*
+          This program is free software: you can redistribute it and/or modify
+          it under the terms of the GNU General Public License as published by
+          the Free Software Foundation, either version 2 of the License, or
+          (at your option) any later version.
+
+          This program is distributed in the hope that it will be useful,
+          but WITHOUT ANY WARRANTY; without even the implied warranty of
+          MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+          GNU General Public License for more details.
+
+          You should have received a copy of the GNU General Public License
+          along with this program.  If not, see <http://www.gnu.org/licenses/>.
+       */
+
        include_class('rental', 'model', 'inc/model/');
        include_class('rental', 'contract_date', 'inc/model/');
        include_class('rental', 'invoice', 'inc/model/');




reply via email to

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