fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [7458] property: request: planning


From: Sigurd Nes
Subject: [Fmsystem-commits] [7458] property: request: planning
Date: Sun, 03 Jul 2011 13:29:48 +0000

Revision: 7458
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=7458
Author:   sigurdne
Date:     2011-07-03 13:29:48 +0000 (Sun, 03 Jul 2011)
Log Message:
-----------
property: request: planning

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/setup/phpgw_no.lang
    trunk/property/setup/setup.inc.php
    trunk/property/setup/tables_current.inc.php
    trunk/property/setup/tables_update.inc.php
    trunk/property/templates/base/request.xsl

Modified: trunk/property/inc/class.borequest.inc.php
===================================================================
--- trunk/property/inc/class.borequest.inc.php  2011-07-01 13:47:55 UTC (rev 
7457)
+++ trunk/property/inc/class.borequest.inc.php  2011-07-03 13:29:48 UTC (rev 
7458)
@@ -422,6 +422,17 @@
                                $values['location_data'] 
=$this->solocation->read_single($values['location_code']);
                        }
 
+                       if(isset($values['planning']) && $values['planning'])
+                       {
+                               foreach ($values['planning'] as &$planning)
+                               {
+                                       $planning['date'] = 
$GLOBALS['phpgw']->common->show_date($planning['date'],'Y');
+                               }
+                       }
+                       else
+                       {
+                               $values['planning'] = array();
+                       }
                        if(isset($values['consume']) && $values['consume'])
                        {
                                foreach ($values['consume'] as &$consume)
@@ -570,6 +581,7 @@
                        $request['location_code']       = implode("-", 
$location);
                        $request['start_date']          = 
phpgwapi_datetime::date_to_timestamp($request['start_date']);
                        $request['end_date']            = 
phpgwapi_datetime::date_to_timestamp($request['end_date']);
+                       $request['planning_date']       = 
phpgwapi_datetime::date_to_timestamp($request['planning_date']);
                        $request['consume_date']        = 
phpgwapi_datetime::date_to_timestamp($request['consume_date']);
 
                        if(is_array($values_attribute))

Modified: trunk/property/inc/class.sorequest.inc.php
===================================================================
--- trunk/property/inc/class.sorequest.inc.php  2011-07-01 13:47:55 UTC (rev 
7457)
+++ trunk/property/inc/class.sorequest.inc.php  2011-07-03 13:29:48 UTC (rev 
7458)
@@ -501,6 +501,21 @@
                                $location_code = $this->db->f('location_code');
                                $request['power_meter']         = 
$this->soproject->get_power_meter($location_code);
 
+                               $sql = "SELECT * FROM fm_request_planning WHERE 
request_id={$request_id} ORDER BY date ASC";
+                               $this->db->query($sql,__LINE__,__FILE__);
+                               while($this->db->next_record())
+                               {
+                                       $request['planning'][] = array
+                                       (
+                                               'id'                    => 
$this->db->f('id'),
+                                               'amount'                => 
$this->db->f('amount'),
+                                               'date'                  => 
$this->db->f('date'),
+                                               'user_id'               => 
$this->db->f('user_id'),
+                                               'entry_date'    => 
$this->db->f('entry_date'),
+                                               'descr'                 => 
$this->db->f('descr',true)
+                                       );
+                               }
+
                                $sql = "SELECT * FROM fm_request_consume WHERE 
request_id={$request_id} ORDER BY date ASC";
                                $this->db->query($sql,__LINE__,__FILE__);
                                while($this->db->next_record())
@@ -692,6 +707,17 @@
                                $this->db->query("UPDATE fm_request SET 
$value_set WHERE id= '{$id}'",__LINE__,__FILE__);
                        }
 
+                       if($request['planning_value'] && 
$request['planning_date'])
+                       {
+                               $this->db->query("INSERT INTO 
fm_request_planning (request_id,amount,date,user_id,entry_date) "
+                                       . "VALUES ('"
+                                       . $id . "','"
+                                       . (int)$request['planning_value'] . "',"
+                                       . (int)$request['planning_date']. ","
+                                       . $this->account . ","
+                                       . time() . ")",__LINE__,__FILE__);
+                       }
+
                        if($request['consume_value'] && 
$request['consume_date'])
                        {
                                $this->db->query("INSERT INTO 
fm_request_consume (request_id,amount,date,user_id,entry_date) "
@@ -832,6 +858,25 @@
                                
$this->soproject->update_power_meter($request['power_meter'],$request['location_code'],$address);
                        }
 
+                       if($request['planning_value'] && 
$request['planning_date'])
+                       {
+                               $this->db->query("INSERT INTO 
fm_request_planning (request_id,amount,date,user_id,entry_date) "
+                                       . "VALUES ('"
+                                       . $request['id']. "','"
+                                       . (int)$request['planning_value'] . "',"
+                                       . (int)$request['planning_date']. ","
+                                       . $this->account . ","
+                                       . time() . ")",__LINE__,__FILE__);
+                       }
+
+                       if(isset($request['delete_planning']) && 
is_array($request['delete_planning']))
+                       {
+                               foreach ($request['delete_planning'] as 
$delete_planning)
+                               {
+                                       $this->db->query("DELETE FROM 
fm_request_planning WHERE id =" . (int)$delete_planning,__LINE__,__FILE__);     
                          
+                               }
+                       }
+
                        if($request['consume_value'] && 
$request['consume_date'])
                        {
                                $this->db->query("INSERT INTO 
fm_request_consume (request_id,amount,date,user_id,entry_date) "
@@ -881,6 +926,7 @@
                {
                        $request_id = (int) $request_id;
                        $this->db->transaction_begin();
+                       $this->db->query("DELETE FROM fm_request_planning WHERE 
request_id = {$request_id}",__LINE__,__FILE__);
                        $this->db->query("DELETE FROM fm_request_consume WHERE 
request_id = {$request_id}",__LINE__,__FILE__);
                        $this->db->query("DELETE FROM fm_request_condition 
WHERE request_id = {$request_id}",__LINE__,__FILE__);
                        $this->db->query("DELETE FROM fm_request_history  WHERE 
 history_record_id = {$request_id}",__LINE__,__FILE__);

Modified: trunk/property/inc/class.uirequest.inc.php
===================================================================
--- trunk/property/inc/class.uirequest.inc.php  2011-07-01 13:47:55 UTC (rev 
7457)
+++ trunk/property/inc/class.uirequest.inc.php  2011-07-03 13:29:48 UTC (rev 
7458)
@@ -973,6 +973,10 @@
                                {
                                        
$receipt['error'][]=array('msg'=>lang('Please select a date !'));
                                }
+                               if($values['planning_value'] && 
!$values['planning_date'])
+                               {
+                                       
$receipt['error'][]=array('msg'=>lang('Please select a date !'));
+                               }
 
 
                                if(isset($values['budget']) && 
$values['budget'] && !ctype_digit($values['budget']))
@@ -1202,6 +1206,7 @@
                        }
 
                        $jscal->add_listener('values_consume_date');
+                       $jscal->add_listener('values_planning_date');
                        $msgbox_data = $this->bocommon->msgbox_data($receipt);
 
                        $link_file_data = array
@@ -1275,18 +1280,23 @@
 
                        if($this->acl_edit)
                        {
-                               $lang_delete_consume = lang('Check to delete');
+                               $_lang_delete = lang('Check to delete');
                                foreach($values['consume'] as & $consume)
                                {
-                                       $consume['delete'] = "<input 
type='checkbox' name='values[delete_consume][]' value='{$consume['id']}' 
title='{$lang_delete_consume}'>";
+                                       $consume['delete'] = "<input 
type='checkbox' name='values[delete_consume][]' value='{$consume['id']}' 
title='{$_lang_delete}'>";
                                }
+                               foreach($values['planning'] as & $planning)
+                               {
+                                       $planning['delete'] = "<input 
type='checkbox' name='values[delete_planning][]' value='{$planning['id']}' 
title='{$_lang_delete}'>";
+                               }
+
                        }
                        
                        $datavalues[2] = array
                                (
                                        'name'                                  
=> "2",
-                                       'values'                                
=> json_encode($values['consume']),
-                                       'total_records'                 => 
count($values['consume']),
+                                       'values'                                
=> json_encode($values['planning']),
+                                       'total_records'                 => 
count($values['planning']),
                                        'edit_action'                   => "''",
                                        'is_paginator'                  => 0,
                                        'footer'                                
=> 0
@@ -1302,7 +1312,27 @@
                                                                                
                                array('key' => 
'delete','label'=>lang('delete'),'sortable'=>false,'resizeable'=>false)))
                                );
 
+                       $datavalues[3] = array
+                               (
+                                       'name'                                  
=> "3",
+                                       'values'                                
=> json_encode($values['consume']),
+                                       'total_records'                 => 
count($values['consume']),
+                                       'edit_action'                   => "''",
+                                       'is_paginator'                  => 0,
+                                       'footer'                                
=> 0
+                               );
 
+
+
+                       $myColumnDefs[3] = array
+                               (
+                                       'name'          => "3",
+                                       'values'        =>      
json_encode(array(      array('key' => 
'amount','label'=>lang('amount'),'sortable'=>true,'resizeable'=>true, 
'formatter' => FormatterRight),
+                                                                               
                                array('key' => 
'date','label'=>lang('date'),'sortable'=>true,'resizeable'=>true),
+                                                                               
                                array('key' => 
'delete','label'=>lang('delete'),'sortable'=>false,'resizeable'=>false)))
+                               );
+
+
                        if (isset($values['attributes']) && 
is_array($values['attributes']))
                        {
                                foreach ($values['attributes'] as & $attribute)

Modified: trunk/property/setup/phpgw_no.lang
===================================================================
--- trunk/property/setup/phpgw_no.lang  2011-07-01 13:47:55 UTC (rev 7457)
+++ trunk/property/setup/phpgw_no.lang  2011-07-03 13:29:48 UTC (rev 7458)
@@ -353,6 +353,11 @@
 consume date   property        no      Dato historisk forbruk
 consume value  property        no      Beløp historisk forbruk
 consume history        property        no      Historisk forbruk
+planning       property        no      Planlagt
+planning date  property        no      Dato planagt disponering
+planning value property        no      Beløp planagt disponering
+planning serie property        no      Planagt disponering
+
 check to delete        property        no      Merk for å slette
 contact        property        no      Kontakt
 contact email  property        no      Epost

Modified: trunk/property/setup/setup.inc.php
===================================================================
--- trunk/property/setup/setup.inc.php  2011-07-01 13:47:55 UTC (rev 7457)
+++ trunk/property/setup/setup.inc.php  2011-07-03 13:29:48 UTC (rev 7458)
@@ -12,7 +12,7 @@
        */
 
        $setup_info['property']['name']                 = 'property';
-       $setup_info['property']['version']              = '0.9.17.619';
+       $setup_info['property']['version']              = '0.9.17.620';
        $setup_info['property']['app_order']    = 8;
        $setup_info['property']['enable']               = 1;
        $setup_info['property']['app_group']    = 'office';
@@ -117,6 +117,7 @@
                'fm_request_status',
                'fm_request_history',
                'fm_request_consume',
+               'fm_request_planning',
                'fm_template',
                'fm_template_hours',
                'fm_chapter',

Modified: trunk/property/setup/tables_current.inc.php
===================================================================
--- trunk/property/setup/tables_current.inc.php 2011-07-01 13:47:55 UTC (rev 
7457)
+++ trunk/property/setup/tables_current.inc.php 2011-07-03 13:29:48 UTC (rev 
7458)
@@ -850,6 +850,21 @@
                        'ix' => array(),
                        'uc' => array()
                ),
+               'fm_request_planning' => array(
+                       'fd' => array(
+                               'id' => array('type' => 'auto','nullable' => 
False),
+                               'request_id' => array('type' => 
'int','precision' => '4','nullable' => False),
+                               'amount' => array('type' => 'int','precision' 
=> '4','nullable' => False),
+                               'date' => array('type' => 'int','precision' => 
'4','nullable' => False),
+                               'user_id' => array('type' => 'int','precision' 
=> '4','nullable' => true),
+                               'entry_date' => array('type' => 
'int','precision' => '4','nullable' => true),
+                               'descr' => array('type' => 'text','nullable' => 
True)
+                       ),
+                       'pk' => array('id'),
+                       'fk' => array('fm_request' => array('request_id' => 
'id')),
+                       'ix' => array(),
+                       'uc' => array()
+               ),
                'fm_ns3420' => array(
                        'fd' => array(
                                'id' => array('type' => 'varchar','precision' 
=> '20','nullable' => False),

Modified: trunk/property/setup/tables_update.inc.php
===================================================================
--- trunk/property/setup/tables_update.inc.php  2011-07-01 13:47:55 UTC (rev 
7457)
+++ trunk/property/setup/tables_update.inc.php  2011-07-03 13:29:48 UTC (rev 
7458)
@@ -5309,7 +5309,42 @@
                }
        }
 
+       /**
+       * Update property version from 0.9.17.619 to 0.9.17.620
+       * Add tentative planning to request
+       * 
+       */
 
+       $test[] = '0.9.17.619';
+       function property_upgrade0_9_17_619()
+       {
+               $GLOBALS['phpgw_setup']->oProc->m_odb->transaction_begin();
+
+               $GLOBALS['phpgw_setup']->oProc->CreateTable(
+                       'fm_request_planning', array(
+                               'fd' => array(
+                                       'id' => array('type' => 
'auto','nullable' => False),
+                                       'request_id' => array('type' => 
'int','precision' => '4','nullable' => False),
+                                       'amount' => array('type' => 
'int','precision' => '4','nullable' => False),
+                                       'date' => array('type' => 
'int','precision' => '4','nullable' => False),
+                                       'user_id' => array('type' => 
'int','precision' => '4','nullable' => true),
+                                       'entry_date' => array('type' => 
'int','precision' => '4','nullable' => true),
+                                       'descr' => array('type' => 
'text','nullable' => True)
+                               ),
+                               'pk' => array('id'),
+                               'fk' => array('fm_request' => 
array('request_id' => 'id')),
+                               'ix' => array(),
+                               'uc' => array()
+                       )
+               );
+
+               if($GLOBALS['phpgw_setup']->oProc->m_odb->transaction_commit())
+               {
+                       $GLOBALS['setup_info']['property']['currentver'] = 
'0.9.17.620';
+                       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/request.xsl
===================================================================
--- trunk/property/templates/base/request.xsl   2011-07-01 13:47:55 UTC (rev 
7457)
+++ trunk/property/templates/base/request.xsl   2011-07-03 13:29:48 UTC (rev 
7458)
@@ -417,6 +417,42 @@
 
                                                        <tr>
                                                                <td 
valign="top">
+                                                                               
<xsl:value-of select="php:function('lang', 'planning date')" />
+                                                               </td>
+                                                               <td>
+                                                                       <input 
type="text" id="values_planning_date" name="values[planning_date]" size="10" 
value="" readonly="readonly" >
+                                                                               
<xsl:attribute name="title">
+                                                                               
        <xsl:value-of select="php:function('lang', 'planning date')" />
+                                                                               
</xsl:attribute>
+                                                                       </input>
+                                                                       <img 
id="values_planning_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="php:function('lang', 'planning value')" />
+                                                               </td>
+                                                               <td>
+                                                                       <input 
type="text" id="values_planning_value" name="values[planning_value]" size="10" 
value="{value_planning}" >
+                                                                               
<xsl:attribute name="title">
+                                                                               
        <xsl:value-of select="php:function('lang', 'planning value')" />
+                                                                               
</xsl:attribute>
+                                                                       </input>
+                                                                       
<xsl:text> </xsl:text> [ <xsl:value-of select="currency"/> ]
+                                                               </td>
+                                                       </tr>
+
+                                                       <tr>
+                                                               <td width="19%" 
align="left" valign="top">
+                                                                       
<xsl:value-of select="php:function('lang', 'planning serie')" />
+                                                               </td>
+                                                               <td>
+                                                                       <div 
id="datatable-container_2"></div>
+                                                               </td>
+                                                       </tr>
+
+                                                       <tr>
+                                                               <td 
valign="top">
                                                                                
<xsl:value-of select="php:function('lang', 'consume date')" />
                                                                </td>
                                                                <td>
@@ -442,14 +478,14 @@
                                                                </td>
                                                        </tr>
 
-                                                                       <tr>
-                                                                               
<td width="19%" align="left" valign="top">
-                                                                               
        <xsl:value-of select="php:function('lang', 'consume history')" />
-                                                                               
</td>
-                                                                               
<td>
-                                                                               
        <div id="datatable-container_2"></div>
-                                                                               
</td>
-                                                                       </tr>
+                                                       <tr>
+                                                               <td width="19%" 
align="left" valign="top">
+                                                                       
<xsl:value-of select="php:function('lang', 'consume history')" />
+                                                               </td>
+                                                               <td>
+                                                                       <div 
id="datatable-container_3"></div>
+                                                               </td>
+                                                       </tr>
 
 <!--
                                                        <tr>




reply via email to

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