fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [7558] property: date search and formatting


From: Sigurd Nes
Subject: [Fmsystem-commits] [7558] property: date search and formatting
Date: Tue, 06 Sep 2011 12:22:16 +0000

Revision: 7558
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=7558
Author:   sigurdne
Date:     2011-09-06 12:22:15 +0000 (Tue, 06 Sep 2011)
Log Message:
-----------
property: date search and formatting

Modified Paths:
--------------
    trunk/property/inc/class.borequest.inc.php
    trunk/property/inc/class.sorequest.inc.php
    trunk/property/inc/class.uirequest.inc.php
    trunk/property/js/yahoo/request.index.js
    trunk/property/setup/phpgw_no.lang
    trunk/property/templates/base/request.xsl

Modified: trunk/property/inc/class.borequest.inc.php
===================================================================
--- trunk/property/inc/class.borequest.inc.php  2011-09-05 13:57:43 UTC (rev 
7557)
+++ trunk/property/inc/class.borequest.inc.php  2011-09-06 12:22:15 UTC (rev 
7558)
@@ -78,6 +78,9 @@
                        $allrows                = phpgw::get_var('allrows', 
'bool');
                        $this->p_num    = phpgw::get_var('p_num');
 
+                       $start_date             = phpgw::get_var('start_date');
+                       $end_date               = phpgw::get_var('end_date');
+
                        if(isset($_POST['start']) || isset($_GET['start']))
                        {
                                $this->start = $start;
@@ -118,6 +121,16 @@
                        {
                                $this->allrows = $allrows;
                        }
+
+                       if(array_key_exists('start_date',$_POST) || 
array_key_exists('start_date',$_GET))
+                       {
+                               $this->start_date = $start_date;
+                       }
+                       if(array_key_exists('end_date',$_POST) || 
array_key_exists('end_date',$_GET))
+                       {
+                               $this->end_date = $end_date;
+                       }
+
                }
 
                function save_sessiondata($data)
@@ -140,6 +153,9 @@
                        $this->district_id      = $data['district_id'];
                        $this->cat_id           = $data['cat_id'];
                        $this->status_id        = $data['status_id'];
+                       $this->start_date               = 
isset($data['start_date']) ? $data['start_date']: '';
+                       $this->end_date                 = 
isset($data['end_date']) ? $data['end_date']: '';
+
                }
 
 
@@ -378,7 +394,7 @@
                        $request = $this->so->read(array('start' => 
$this->start,'query' => $this->query,'sort' => $this->sort,'order' => 
$this->order,
                                'filter' => $this->filter,'district_id' => 
$this->district_id,'cat_id' => $this->cat_id,'status_id' => $this->status_id,
                                'project_id' => 
$data['project_id'],'allrows'=>$data['allrows'],'list_descr' => 
$data['list_descr'],
-                               'dry_run'=>$data['dry_run'], 'p_num' => 
$this->p_num));
+                               'dry_run'=>$data['dry_run'], 'p_num' => 
$this->p_num,'start_date'=>$this->start_date,'end_date'=>$this->end_date));
                        $this->total_records = $this->so->total_records;
 
                        $this->uicols   = $this->so->uicols;

Modified: trunk/property/inc/class.sorequest.inc.php
===================================================================
--- trunk/property/inc/class.sorequest.inc.php  2011-09-05 13:57:43 UTC (rev 
7557)
+++ trunk/property/inc/class.sorequest.inc.php  2011-09-06 12:22:15 UTC (rev 
7558)
@@ -27,6 +27,8 @@
        * @version $Id$
        */
 
+       phpgw::import_class('phpgwapi.datetime');
+
        /**
         * Description
         * @package property
@@ -190,7 +192,7 @@
 
                function read($data)
                {
-                       $start                  = isset($data['start']) && 
$data['start'] ? $data['start'] : 0;
+                       $start                  = isset($data['start']) && 
$data['start'] ? (int)$data['start'] : 0;
                        $filter                 = 
isset($data['filter'])?$data['filter']:'';
                        $query                  = 
isset($data['query'])?$data['query']:'';
                        $sort                   = isset($data['sort']) && 
$data['sort'] ? $data['sort'] : 'DESC';
@@ -203,6 +205,8 @@
                        $list_descr             = 
isset($data['list_descr'])?$data['list_descr']:'';
                        $dry_run                = isset($data['dry_run']) ? 
$data['dry_run'] : '';
                        $p_num                  = isset($data['p_num']) ? 
$data['p_num'] : '';
+                       $start_date             = isset($data['start_date']) && 
$data['start_date'] ? phpgwapi_datetime::date_to_timestamp($data['start_date']) 
: 0;
+                       $end_date               = isset($data['end_date']) && 
$data['end_date'] ? phpgwapi_datetime::date_to_timestamp($data['end_date']) : 0;
 
                        $location_id = 
$GLOBALS['phpgw']->locations->get_id('property', '.project.request');
                        $attribute_table = 'phpgw_cust_attribute';
@@ -298,7 +302,7 @@
                        $uicols['exchange'][]           = '';
                        $uicols['align'][]                      = '';
                        $uicols['datatype'][]           = '';
-                       $uicols['formatter'][]          = '';
+                       $uicols['formatter'][]          = 'FormatterRight';
                        $uicols['classname'][]          = '';
                        $uicols['sortable'][]           = true;
 
@@ -325,7 +329,7 @@
                        $uicols['exchange'][]           = '';
                        $uicols['align'][]                      = '';
                        $uicols['datatype'][]           = '';
-                       $uicols['formatter'][]          = '';
+                       $uicols['formatter'][]          = 'FormatterRight';
                        $uicols['classname'][]          = '';
                        $uicols['sortable'][]           = true;
 
@@ -388,6 +392,15 @@
                                $where = 'AND';
                        }
 
+                       if ($start_date)
+                       {
+                               $end_date       = $end_date + 3600 * 16 + 
phpgwapi_datetime::user_timezone();
+                               $start_date     = $start_date - 3600 * 8 + 
phpgwapi_datetime::user_timezone();
+
+                               $filtermethod .= " $where fm_request.start_date 
>= $start_date AND fm_request.start_date <= $end_date ";
+                               $where= 'AND';
+                       }
+
                        if ($filter)
                        {
                                $filtermethod .= " $where 
fm_request.coordinator='$filter' ";

Modified: trunk/property/inc/class.uirequest.inc.php
===================================================================
--- trunk/property/inc/class.uirequest.inc.php  2011-09-05 13:57:43 UTC (rev 
7557)
+++ trunk/property/inc/class.uirequest.inc.php  2011-09-06 12:22:15 UTC (rev 
7558)
@@ -87,6 +87,8 @@
                        $this->cat_id                           = 
$this->bo->cat_id;
                        $this->status_id                        = 
$this->bo->status_id;
                        $this->district_id                      = 
$this->bo->district_id;
+                       $this->start_date                       = 
$this->bo->start_date;
+                       $this->end_date                         = 
$this->bo->end_date;
 
                        $this->allrows                          = 
$this->bo->allrows;
                        $this->p_num                            = 
$this->bo->p_num;
@@ -104,7 +106,9 @@
                                        'cat_id'                => 
$this->cat_id,
                                        'status_id'             => 
$this->status_id,
                                        'district_id'   => $this->district_id,
-                                       'allrows'               => 
$this->allrows
+                                       'allrows'               => 
$this->allrows,
+                                       'start_date'    => $this->start_date,
+                                       'end_date'              => 
$this->end_date,
                                );
                        $this->bo->save_sessiondata($data);
                }
@@ -193,6 +197,9 @@
                                $lookup = true;
                        }
 
+                       $start_date     = urldecode($this->start_date);
+                       $end_date               = urldecode($this->end_date);
+
                        $this->save_sessiondata();
 
                        $dry_run = false;
@@ -215,6 +222,9 @@
                                                'project_id'    => $project_id,
                //                              'query'         => $this->query,
                                                'p_num'         => $this->p_num,
+                                               'start_date'=> 
$this->start_date,
+                                               'end_date'      => 
$this->end_date
+
                                        ));
                                $datatable['config']['allow_allrows'] = true;
 
@@ -226,6 +236,8 @@
                                        ."filter:'{$this->filter}',"
                                        ."status_id:'{$this->status_id}',"
                                        ."district_id: '{$this->district_id}',"
+                                       ."start_date:'{$this->start_date}',"
+                                       ."end_date: '{$this->end_date}',"
                                        ."cat_id:'{$this->cat_id}'";
 
                                $values_combo_box[0]  = 
$this->bocommon->select_district_list('filter',$this->district_id);
@@ -259,7 +271,10 @@
                                                                'status_id'     
                => $this->status_id,
                                                                'project_id'    
        => $project_id,
                                                                'district_id'   
    => $this->district_id,
-                                                               'query'         
                => $this->query
+                                                               'query'         
                => $this->query,
+                                                               'start_date'    
        => $this->start_date,
+                                                               'end_date'      
                => $this->end_date
+
                                                        )
                                                ),
                                                'fields'        => array
@@ -325,6 +340,35 @@
                                                                        
'tab_index' => 7
                                                                ),
                                                                array
+                                                               (
+                                                                       'type'  
=> 'hidden',
+                                                                       'id'    
=> 'start_date',
+                                                                       'value' 
=> $start_date
+                                                               ),
+                                                               array
+                                                               (
+                                                                       'type'  
=> 'hidden',
+                                                                       'id'    
=> 'end_date',
+                                                                       'value' 
=> $end_date
+                                                               ),
+                                                               array
+                                                               (
+                                                                       
'type'=> 'label_date'
+                                                               ),
+                                                               array
+                                                               (
+                                                                       
'type'=> 'link',
+                                                                       'id'  
=> 'btn_date_search',
+                                                                       'url' 
=> "Javascript:window.open('".$GLOBALS['phpgw']->link('/index.php',
+                                                                       array
+                                                                       (
+                                                                               
'menuaction' => 'property.uiproject.date_search')
+                                                                       
)."','','width=350,height=250')",
+                                                                       'value' 
=> lang('Date search'),
+                                                                       
'tab_index' => 9
+                                                               ),
+
+                                                               array
                                                                ( //boton     
SEARCH
                                                                        'id' => 
'btn_search',
                                                                        'name' 
=> 'search',

Modified: trunk/property/js/yahoo/request.index.js
===================================================================
--- trunk/property/js/yahoo/request.index.js    2011-09-05 13:57:43 UTC (rev 
7557)
+++ trunk/property/js/yahoo/request.index.js    2011-09-06 12:22:15 UTC (rev 
7558)
@@ -31,15 +31,21 @@
 
        var linktoolTips =
        [
-           {name:'btn_priority_key', title:'Priority key', description:'To 
alter the Priority key'}
+           {name:'btn_priority_key', title:'Priority key', description:'To 
alter the Priority key'},
+               {name:'btn_date_search', title:'Date search', 
description:'Narrow the search by dates'}
        ]
 
        // define the hidden column in datatable
        var config_values = {
-               date_search : 0 //if search has link "Data search"
+               date_search : 1 //if search has link "Data search"
        };
 
/****************************************************************************************/
 
+       var FormatterRight = function(elCell, oRecord, oColumn, oData)
+       {
+               elCell.innerHTML = "<div 
align=\"right\">"+YAHOO.util.Number.format(oData, {thousandsSeparator:" 
"})+"</div>";
+       }
+
        this.particular_setting = function()
        {
                if(flag_particular_setting=='init')

Modified: trunk/property/setup/phpgw_no.lang
===================================================================
--- trunk/property/setup/phpgw_no.lang  2011-09-05 13:57:43 UTC (rev 7557)
+++ trunk/property/setup/phpgw_no.lang  2011-09-06 12:22:15 UTC (rev 7558)
@@ -1376,7 +1376,7 @@
 schedule       property        no      planlegge (tid)
 scheduled events       property        no      Planlagte oppgaver
 schedule the method    property        no      Tidsplanlegging
-score  property        no      poengsum
+score  property        no      Poengsum
 search by bruk. to show all entries, empty all fields and press the submit 
button again        property        no      Søk etter BruksNr
 search by feste. to show all entries, empty all fields and press the submit 
button again       property        no      Søk etter FesteNr
 search by gaards nr. to show all entries, empty all fields and press the 
submit button again   property        no      Søk etter GårdsNr
@@ -1627,7 +1627,7 @@
 subject has been updated       property        no      Overskrift er oppdatert
 submit the search string       property        no      Send søkestrengen
 sum estimated cost     property        no      Sum estimert kostnad
-sum orders     property        no      Sum bestilling
+sum orders     property        no      Forpliktet, ikke betalt
 sum    property        no      Sum
 sum calculation        property        no      Sum kalkulasjon
 sum deviation  property        no      Sum avvik

Modified: trunk/property/templates/base/request.xsl
===================================================================
--- trunk/property/templates/base/request.xsl   2011-09-05 13:57:43 UTC (rev 
7557)
+++ trunk/property/templates/base/request.xsl   2011-09-06 12:22:15 UTC (rev 
7558)
@@ -989,7 +989,7 @@
                -->
                        <th width="5%" align="center">
                                        <xsl:attribute name="title">
-                                               <xsl:text>Vekt = konfigurerbar 
verdi for hjelpeberegning av viktighet</xsl:text>
+                                               <xsl:text>Vekt = konfigurerbar 
verdi pr konsekvenstype</xsl:text>
                                        </xsl:attribute>
                                <xsl:value-of select="php:function('lang', 
'weight')" />
                        </th>
@@ -1001,7 +1001,7 @@
                        </th>
                        <th width="5%" align="center">
                                        <xsl:attribute name="title">
-                                               <xsl:text>Verdi for hjelp til 
sortering av viktighet</xsl:text>
+                                               <xsl:text>Poeng = Tilstandsgrad 
x Risiko x Vekt</xsl:text>
                                        </xsl:attribute>
 
                                <xsl:value-of select="php:function('lang', 
'score')" />




reply via email to

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