fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [7029] property: configurable dates at request / cate


From: Sigurd Nes
Subject: [Fmsystem-commits] [7029] property: configurable dates at request / categorize request status
Date: Mon, 21 Feb 2011 15:09:46 +0000

Revision: 7029
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=7029
Author:   sigurdne
Date:     2011-02-21 15:09:45 +0000 (Mon, 21 Feb 2011)
Log Message:
-----------
property: configurable dates at request / categorize request status

Modified Paths:
--------------
    trunk/property/inc/class.sogeneric.inc.php
    trunk/property/inc/class.sorequest.inc.php
    trunk/property/inc/class.uirequest.inc.php
    trunk/property/setup/setup.inc.php
    trunk/property/setup/tables_current.inc.php
    trunk/property/setup/tables_update.inc.php
    trunk/property/templates/base/config.tpl
    trunk/property/templates/base/request.xsl

Modified: trunk/property/inc/class.sogeneric.inc.php
===================================================================
--- trunk/property/inc/class.sogeneric.inc.php  2011-02-21 13:55:38 UTC (rev 
7028)
+++ trunk/property/inc/class.sogeneric.inc.php  2011-02-21 15:09:45 UTC (rev 
7029)
@@ -1078,6 +1078,31 @@
                                                                'name' => 
'descr',
                                                                'descr' => 
lang('descr'),
                                                                'type' => 
'varchar'
+                                                       ),
+                                                       array
+                                                       (
+                                                               'name' => 
'sorting',
+                                                               'descr' => 
lang('sorting'),
+                                                               'type' => 
'integer',
+                                                               'sortable'=> 
true
+                                                       ),
+                                                       array
+                                                       (
+                                                               'name' => 
'in_progress',
+                                                               'descr' => 
lang('In progress'),
+                                                               'type' => 
'checkbox'
+                                                       ),
+                                                       array
+                                                       (
+                                                               'name' => 
'delivered',
+                                                               'descr' => 
lang('delivered'),
+                                                               'type' => 
'checkbox'
+                                                       ),
+                                                       array
+                                                       (
+                                                               'name' => 
'closed',
+                                                               'descr' => 
lang('closed'),
+                                                               'type' => 
'checkbox'
                                                        )
                                                ),
                                                'edit_msg'                      
=> lang('edit status'),

Modified: trunk/property/inc/class.sorequest.inc.php
===================================================================
--- trunk/property/inc/class.sorequest.inc.php  2011-02-21 13:55:38 UTC (rev 
7028)
+++ trunk/property/inc/class.sorequest.inc.php  2011-02-21 15:09:45 UTC (rev 
7029)
@@ -43,6 +43,7 @@
                        $this->custom           = 
createObject('property.custom_fields');
                        $this->db           = & $GLOBALS['phpgw']->db;
                        $this->join                     = & $this->db->join;
+                       $this->left_join        = & $this->db->left_join;
                        $this->like                     = & $this->db->like;
                        $this->interlink        = 
CreateObject('property.interlink');
                }
@@ -122,16 +123,18 @@
 
                function select_status_list()
                {
-                       $this->db->query("SELECT id, descr FROM 
fm_request_status ORDER BY id ");
+                       $this->db->query("SELECT id, descr FROM 
fm_request_status ORDER BY sorting ");
 
-                       $i = 0;
+                       $status = array();
                        while ($this->db->next_record())
                        {
-                               $status_entries[$i]['id']                       
        = $this->db->f('id');
-                               $status_entries[$i]['name']                     
        = stripslashes($this->db->f('descr'));
-                               $i++;
+                               $status[] = array
+                               (
+                                       'id'    => $this->db->f('id'),
+                                       'name'  => $this->db->f('descr',true)
+                               );
                        }
-                       return $status_entries;
+                       return $status;
                }
 
                function select_condition_type_list()
@@ -192,21 +195,55 @@
                        $uicols['name'][]                       = 'request_id';
                        $uicols['descr'][]                      = 
lang('Request');
                        $uicols['statustext'][]         = lang('Request ID');
+                       $uicols['exchange'][]           = '';
+                       $uicols['align'][]                      = '';
+                       $uicols['datatype'][]           = '';
+                       $uicols['formatter'][]          = '';
+                       $uicols['classname'][]          = '';
+                       $uicols['sortable'][]           = true;
 
+
+                       $cols.= ",fm_request_status.descr as status";
+                       $cols_return[]                          = 'status';
+                       $uicols['input_type'][]         = 'text';
+                       $uicols['name'][]                       = 'status';
+                       $uicols['descr'][]                      = 
lang('status');
+                       $uicols['statustext'][]         = lang('status');
+                       $uicols['exchange'][]           = '';
+                       $uicols['align'][]                      = '';
+                       $uicols['datatype'][]           = '';
+                       $uicols['formatter'][]          = '';
+                       $uicols['classname'][]          = '';
+                       $uicols['sortable'][]           = false;
+
                        $cols.= ",$entity_table.start_date";
                        $cols_return[]                          = 'start_date';
                        $uicols['input_type'][]         = 'text';
                        $uicols['name'][]                       = 'start_date';
                        $uicols['descr'][]                      = lang('start 
date');
                        $uicols['statustext'][]         = lang('Request start 
date');
+                       $uicols['exchange'][]           = '';
+                       $uicols['align'][]                      = '';
+                       $uicols['datatype'][]           = '';
+                       $uicols['formatter'][]          = '';
+                       $uicols['classname'][]          = '';
+                       $uicols['sortable'][]           = true;
 
+
                        $cols.= ",$entity_table.title as title";
                        $cols_return[]                          = 'title';
                        $uicols['input_type'][]         = 'text';
                        $uicols['name'][]                       = 'title';
                        $uicols['descr'][]                      = lang('title');
                        $uicols['statustext'][]         = lang('Request title');
+                       $uicols['exchange'][]           = '';
+                       $uicols['align'][]                      = '';
+                       $uicols['datatype'][]           = '';
+                       $uicols['formatter'][]          = '';
+                       $uicols['classname'][]          = '';
+                       $uicols['sortable'][]           = true;
 
+
                        if($list_descr)
                        {
                                $cols.= ",$entity_table.descr as descr";
@@ -215,6 +252,12 @@
                                $uicols['name'][]                       = 
'descr';
                                $uicols['descr'][]                      = 
lang('descr');
                                $uicols['statustext'][]         = lang('Request 
descr');
+                               $uicols['exchange'][]           = '';
+                               $uicols['align'][]                      = '';
+                               $uicols['datatype'][]           = '';
+                               $uicols['formatter'][]          = '';
+                               $uicols['classname'][]          = '';
+                               $uicols['sortable'][]           = false;
                        }
 
 
@@ -224,6 +267,12 @@
                        $uicols['name'][]                       = 'budget';
                        $uicols['descr'][]                      = 
lang('budget');
                        $uicols['statustext'][]         = lang('Request 
budget');
+                       $uicols['exchange'][]           = '';
+                       $uicols['align'][]                      = '';
+                       $uicols['datatype'][]           = '';
+                       $uicols['formatter'][]          = '';
+                       $uicols['classname'][]          = '';
+                       $uicols['sortable'][]           = true;
 
                        $cols.= ",$entity_table.coordinator";
                        $cols_return[]                          = 'coordinator';
@@ -231,14 +280,31 @@
                        $uicols['name'][]                       = 'coordinator';
                        $uicols['descr'][]                      = 
lang('Coordinator');
                        $uicols['statustext'][]         = lang('Project 
coordinator');
+                       $uicols['exchange'][]           = '';
+                       $uicols['align'][]                      = '';
+                       $uicols['datatype'][]           = '';
+                       $uicols['formatter'][]          = '';
+                       $uicols['classname'][]          = '';
+                       $uicols['sortable'][]           = false;
 
+
                        $cols.= ",$entity_table.score";
                        $cols_return[]                          = 'score';
                        $uicols['input_type'][]         = 'text';
                        $uicols['name'][]                       = 'score';
                        $uicols['descr'][]                      = lang('score');
                        $uicols['statustext'][]         = lang('score');
+                       $uicols['exchange'][]           = '';
+                       $uicols['align'][]                      = '';
+                       $uicols['datatype'][]           = '';
+                       $uicols['formatter'][]          = '';
+                       $uicols['classname'][]          = '';
+                       $uicols['sortable'][]           = true;
 
+
+                       $paranthesis = '(';
+                       $joinmethod = "{$this->left_join} fm_request_status ON 
{$entity_table}.status = fm_request_status.id)";
+
                        $sql    = 
$this->bocommon->generate_sql(array('entity_table'=>$entity_table,'cols'=>$cols,'cols_return'=>$cols_return,
                                
'uicols'=>$uicols,'joinmethod'=>$joinmethod,'paranthesis'=>$paranthesis,
                                'query'=>$query,'force_location'=>true));
@@ -265,13 +331,13 @@
 
                        if ($cat_id > 0)
                        {
-                               $filtermethod .= " $where 
fm_request.category='$cat_id' ";
+                               $filtermethod .= " $where 
fm_request.category='{$cat_id}' ";
                                $where = 'AND';
                        }
 
                        if ($status_id)
                        {
-                               $filtermethod .= " $where  
fm_request.status='$status_id' ";
+                               $filtermethod .= " $where  
fm_request.status='{$status_id}' ";
                                $where = 'AND';
                        }
 
@@ -281,9 +347,10 @@
                                $where = 'AND';
                        }
 
-                       if ($project_id)// lookup requests not already 
allocated to projects
+                       if ($project_id && !$status_id)// lookup requests not 
already allocated to projects
                        {
-                               $filtermethod .= " $where project_id is NULL ";
+//                             $filtermethod .= " $where project_id is NULL ";
+                               $filtermethod .= " $where 
fm_request_status.closed is NULL ";
                                $where = 'AND';
                        }
 
@@ -308,7 +375,7 @@
                        }
 
                        $sql .= " $filtermethod $querymethod";
-
+//_debug_array($sql);
                        $this->uicols           = $this->bocommon->uicols;
                        $cols_return            = $this->bocommon->cols_return;
                        $type_id                        = 
$this->bocommon->type_id;

Modified: trunk/property/inc/class.uirequest.inc.php
===================================================================
--- trunk/property/inc/class.uirequest.inc.php  2011-02-21 13:55:38 UTC (rev 
7028)
+++ trunk/property/inc/class.uirequest.inc.php  2011-02-21 15:09:45 UTC (rev 
7029)
@@ -69,7 +69,7 @@
                        $this->cats                                     = & 
$this->bo->cats;
                        $this->bolocation                       = 
CreateObject('property.bolocation');
                        $this->config                           = 
CreateObject('phpgwapi.config','property');
-
+                       $this->config->read();
                        $this->acl                                      = & 
$GLOBALS['phpgw']->acl;
                        $this->acl_location                     = 
'.project.request';
                        $this->acl_read                         = 
$this->acl->check($this->acl_location, PHPGW_ACL_READ, 'property');
@@ -540,25 +540,27 @@
 
                        $uicols_count   = count($uicols['descr']);
 
+                       $show_dates     = 
isset($this->config->config_data['request_show_dates']) && 
$this->config->config_data['request_show_dates'] ? 1 : '';
+
                        for ($i=0;$i<$uicols_count;$i++)
                        {
+                               if(!$show_dates && $uicols['name'][$i] == 
'start_date')
+                               {
+                                       $uicols['input_type'][$i] = 'hidden';
+                               }
 
                                //all colums should be have formatter
                                
$datatable['headers']['header'][$i]['formatter'] = 
($uicols['formatter'][$i]==''?  '""' : $uicols['formatter'][$i]);
-
+                               
                                if($uicols['input_type'][$i]!='hidden')
                                {
                                        
$datatable['headers']['header'][$i]['name']                     = 
$uicols['name'][$i];
                                        
$datatable['headers']['header'][$i]['text']                     = 
$uicols['descr'][$i];
                                        
$datatable['headers']['header'][$i]['visible']                  = true;
                                        
$datatable['headers']['header'][$i]['format']                   = 
$this->bocommon->translate_datatype_format($uicols['datatype'][$i]);
-                                       
$datatable['headers']['header'][$i]['sortable']                 = false;
+                                       
$datatable['headers']['header'][$i]['sortable']                 = 
$uicols['sortable'][$i];
+                                       
$datatable['headers']['header'][$i]['sort_field']               = 
$uicols['name'][$i];
 
-                                       if($uicols['name'][$i]=='request_id' || 
$uicols['name'][$i]=='budget' ||  $uicols['name'][$i]=='score' ||  
$uicols['name'][$i]=='start_date')
-                                       {
-                                               
$datatable['headers']['header'][$i]['sortable']         = true;
-                                               
$datatable['headers']['header'][$i]['sort_field']       = $uicols['name'][$i];
-                                       }
                                        if($uicols['name'][$i]=='loc1')
                                        {
                                                
$datatable['headers']['header'][$i]['sortable']         = true;
@@ -571,7 +573,7 @@
                                        
$datatable['headers']['header'][$i]['name']                     = 
$uicols['name'][$i];
                                        
$datatable['headers']['header'][$i]['text']                     = 
$uicols['descr'][$i];
                                        
$datatable['headers']['header'][$i]['visible']                  = false;
-                                       
$datatable['headers']['header'][$i]['sortable']         = false;
+                                       
$datatable['headers']['header'][$i]['sortable']                 = false;
                                        
$datatable['headers']['header'][$i]['format']                   = 'hidden';
                                }
                        }
@@ -877,7 +879,6 @@
 
 
                        //_debug_array($values);
-                       $this->config->read();
 
                        if ($values['save'] && $mode == 'edit')
                        {
@@ -1122,9 +1123,13 @@
                                        );
                        }
 
-                       $jscal = CreateObject('phpgwapi.jscalendar');
-                       $jscal->add_listener('values_start_date');
-                       $jscal->add_listener('values_end_date');
+                       $show_dates = 
isset($this->config->config_data['request_show_dates']) && 
$this->config->config_data['request_show_dates'] ? 1 : '';
+                       if($show_dates)
+                       {
+                               $jscal = CreateObject('phpgwapi.jscalendar');
+                               $jscal->add_listener('values_start_date');
+                               $jscal->add_listener('values_end_date');
+                       }
 
                        $msgbox_data = $this->bocommon->msgbox_data($receipt);
 
@@ -1214,10 +1219,12 @@
                                }
                        }
 
+                       
                        $data = array
                                (
                                        'mode'                                  
                        => $mode,
                                        'suppressmeter'                         
                => isset($this->config->config_data['project_suppressmeter']) 
&& $this->config->config_data['project_suppressmeter'] ? 1 : '',
+                                       'show_dates'                            
                => $show_dates,
                                        'attributes'                            
                => $values['attributes'],
                                        'property_js'                           
                => 
json_encode($GLOBALS['phpgw_info']['server']['webserver_url']."/property/js/yahoo/property2.js"),
                                        'datatable'                             
                        => $datavalues,
@@ -1383,6 +1390,7 @@
                                
$GLOBALS['phpgw']->redirect_link('/index.php',array('menuaction'=> 
'property.uilocation.stop', 'perm'=>8, 'acl_location'=> $this->acl_location));
                        }
 
+
                        //$id = phpgw::get_var('id', 'int');
                        $confirm        = phpgw::get_var('confirm', 'bool', 
'POST');
 

Modified: trunk/property/setup/setup.inc.php
===================================================================
--- trunk/property/setup/setup.inc.php  2011-02-21 13:55:38 UTC (rev 7028)
+++ trunk/property/setup/setup.inc.php  2011-02-21 15:09:45 UTC (rev 7029)
@@ -12,7 +12,7 @@
        */
 
        $setup_info['property']['name']                 = 'property';
-       $setup_info['property']['version']              = '0.9.17.608';
+       $setup_info['property']['version']              = '0.9.17.609';
        $setup_info['property']['app_order']    = 8;
        $setup_info['property']['enable']               = 1;
        $setup_info['property']['app_group']    = 'office';

Modified: trunk/property/setup/tables_current.inc.php
===================================================================
--- trunk/property/setup/tables_current.inc.php 2011-02-21 13:55:38 UTC (rev 
7028)
+++ trunk/property/setup/tables_current.inc.php 2011-02-21 15:09:45 UTC (rev 
7029)
@@ -818,7 +818,11 @@
                'fm_request_status' => array(
                        'fd' => array(
                                'id' => array('type' => 'varchar','precision' 
=> '20','nullable' => False),
-                               'descr' => array('type' => 
'varchar','precision' => '255','nullable' => False)
+                               'descr' => array('type' => 
'varchar','precision' => '255','nullable' => False),
+                               'closed' => array('type' => 'int','precision' 
=> '2','nullable' => True),
+                               'in_progress' => array('type' => 
'int','precision' => '2','nullable' => True),
+                               'delivered' => array('type' => 
'int','precision' => '2','nullable' => True),
+                               'sorting' => array('type' => 'int','precision' 
=> '4','nullable' => True)
                        ),
                        'pk' => array('id'),
                        'fk' => array(),

Modified: trunk/property/setup/tables_update.inc.php
===================================================================
--- trunk/property/setup/tables_update.inc.php  2011-02-21 13:55:38 UTC (rev 
7028)
+++ trunk/property/setup/tables_update.inc.php  2011-02-21 15:09:45 UTC (rev 
7029)
@@ -5019,7 +5019,34 @@
                }
        }
 
+
+
+
        /**
+       * Update property version from 0.9.17.608 to 0.9.17.609
+       * Add location_link_level
+       * 
+       */
+
+       $test[] = '0.9.17.608';
+       function property_upgrade0_9_17_608()
+       {
+               $GLOBALS['phpgw_setup']->oProc->m_odb->transaction_begin();
+
+               
$GLOBALS['phpgw_setup']->oProc->AddColumn('fm_request_status','closed',array('type'
 => 'int','precision' => 2,'nullable' => True));
+               
$GLOBALS['phpgw_setup']->oProc->AddColumn('fm_request_status','in_progress',array('type'
 => 'int','precision' => 2,'nullable' => True));
+               
$GLOBALS['phpgw_setup']->oProc->AddColumn('fm_request_status','delivered',array('type'
 => 'int','precision' => 2,'nullable' => True));
+               
$GLOBALS['phpgw_setup']->oProc->AddColumn('fm_request_status','sorting',array('type'
 => 'int','precision' => 4,'nullable' => True));
+
+               if($GLOBALS['phpgw_setup']->oProc->m_odb->transaction_commit())
+               {
+                       $GLOBALS['setup_info']['property']['currentver'] = 
'0.9.17.609';
+                       return $GLOBALS['setup_info']['property']['currentver'];
+               }
+       }
+
+
+       /**
        * Update property version from 0.9.17.607 to 0.9.17.608
        * Add more room for address at tickets
        * 

Modified: trunk/property/templates/base/config.tpl
===================================================================
--- trunk/property/templates/base/config.tpl    2011-02-21 13:55:38 UTC (rev 
7028)
+++ trunk/property/templates/base/config.tpl    2011-02-21 15:09:45 UTC (rev 
7029)
@@ -390,6 +390,16 @@
                        </td>
                </tr>
 
+               <tr class="row_off">
+                       <td>{lang_request_show_dates}.</td>
+                       <td>
+                               <select name="newsettings[request_show_dates]">
+                                       <option value="" 
{selected_request_show_dates_}>NO</option>
+                                       <option value="1" 
{selected_request_show_dates_1}>YES</option>
+                               </select>
+                       </td>
+               </tr>
+
                <tr class="row_on">
                        <td>{lang_meter_table}:</td>
                        <td><input name="newsettings[meter_table]" 
value="{value_meter_table}"></td>

Modified: trunk/property/templates/base/request.xsl
===================================================================
--- trunk/property/templates/base/request.xsl   2011-02-21 13:55:38 UTC (rev 
7028)
+++ trunk/property/templates/base/request.xsl   2011-02-21 15:09:45 UTC (rev 
7029)
@@ -339,32 +339,37 @@
                                                                        
</select>                       
                                                                </td>
                                                        </tr>
-                                                       <tr>
-                                                               <td 
valign="top">
-                                                                       
<xsl:value-of select="lang_start_date"/>
-                                                               </td>
-                                                               <td>
-                                                                       <input 
type="text" id="values_start_date" name="values[start_date]" size="10" 
value="{value_start_date}" readonly="readonly" >
-                                                                               
<xsl:attribute name="title">
-                                                                               
        <xsl:value-of select="lang_start_date_statustext"/>
-                                                                               
</xsl:attribute>
-                                                                       </input>
-                                                                       <img 
id="values_start_date-trigger" src="{img_cal}" alt="{lang_datetitle}" 
title="{lang_datetitle}" style="cursor:pointer; cursor:hand;" />
-                                                               </td>
-                                                       </tr>
-                                                       <tr>
-                                                               <td 
valign="top">
-                                                                       
<xsl:value-of select="lang_end_date"/>
-                                                               </td>
-                                                               <td>
-                                                                       <input 
type="text" id="values_end_date" name="values[end_date]" size="10" 
value="{value_end_date}" readonly="readonly" >
-                                                                               
<xsl:attribute name="title">
-                                                                               
        <xsl:value-of select="lang_end_date_statustext"/>
-                                                                               
</xsl:attribute>
-                                                                       </input>
-                                                                       <img 
id="values_end_date-trigger" src="{img_cal}" alt="{lang_datetitle}" 
title="{lang_datetitle}" style="cursor:pointer; cursor:hand;" />
-                                                               </td>
-                                                       </tr>
+
+                                                       <xsl:choose>
+                                                               <xsl:when 
test="show_dates !=''">
+                                                                       <tr>
+                                                                               
<td valign="top">
+                                                                               
        <xsl:value-of select="lang_start_date"/>
+                                                                               
</td>
+                                                                               
<td>
+                                                                               
        <input type="text" id="values_start_date" name="values[start_date]" 
size="10" value="{value_start_date}" readonly="readonly" >
+                                                                               
                <xsl:attribute name="title">
+                                                                               
                        <xsl:value-of select="lang_start_date_statustext"/>
+                                                                               
                </xsl:attribute>
+                                                                               
        </input>
+                                                                               
        <img id="values_start_date-trigger" src="{img_cal}" 
alt="{lang_datetitle}" title="{lang_datetitle}" style="cursor:pointer; 
cursor:hand;" />
+                                                                               
</td>
+                                                                       </tr>
+                                                                       <tr>
+                                                                               
<td valign="top">
+                                                                               
        <xsl:value-of select="lang_end_date"/>
+                                                                               
</td>
+                                                                               
<td>
+                                                                               
        <input type="text" id="values_end_date" name="values[end_date]" 
size="10" value="{value_end_date}" readonly="readonly" >
+                                                                               
                <xsl:attribute name="title">
+                                                                               
                        <xsl:value-of select="lang_end_date_statustext"/>
+                                                                               
                </xsl:attribute>
+                                                                               
        </input>
+                                                                               
        <img id="values_end_date-trigger" src="{img_cal}" 
alt="{lang_datetitle}" title="{lang_datetitle}" style="cursor:pointer; 
cursor:hand;" />
+                                                                               
</td>
+                                                                       </tr>
+                                                               </xsl:when>
+                                                       </xsl:choose>
 <!--
                                                        <tr>
                                                                <td 
valign="top">




reply via email to

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