fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [7151] Merge 7147:7150 from trunk


From: Sigurd Nes
Subject: [Fmsystem-commits] [7151] Merge 7147:7150 from trunk
Date: Thu, 31 Mar 2011 09:04:38 +0000

Revision: 7151
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=7151
Author:   sigurdne
Date:     2011-03-31 09:04:37 +0000 (Thu, 31 Mar 2011)
Log Message:
-----------
Merge 7147:7150 from trunk

Modified Paths:
--------------
    branches/Version-1_0-branch/property/inc/class.borequest.inc.php
    branches/Version-1_0-branch/property/inc/class.sorequest.inc.php
    branches/Version-1_0-branch/property/inc/class.uirequest.inc.php
    branches/Version-1_0-branch/property/js/yahoo/request.edit.js
    branches/Version-1_0-branch/property/setup/phpgw_no.lang
    branches/Version-1_0-branch/property/setup/setup.inc.php
    branches/Version-1_0-branch/property/setup/tables_current.inc.php
    branches/Version-1_0-branch/property/setup/tables_update.inc.php
    branches/Version-1_0-branch/property/templates/base/request.xsl

Added Paths:
-----------
    branches/Version-1_0-branch/activitycalendar/

Property Changed:
----------------
    branches/Version-1_0-branch/


Property changes on: branches/Version-1_0-branch
___________________________________________________________________
Modified: svn:mergeinfo
   - 
/trunk:6439-6441,6443,6445-6447,6449-6464,6466-6468,6470-6474,6476-6477,6479-6480,6483-6488,6490-6491,6493-6494,6496-6501,6503-6504,6506,6508,6510-6511,6513,6515-6516,6518,6520-6524,6526-6528,6533-6534,6536-6541,6543-6565,6567,6569,6571-6576,6578,6580-6586,6588-6596,6598-6600,6602-6604,6606-6607,6609-6611,6613-6625,6629-6639,6641-6643,6645-6646,6648,6650-6654,6656-6659,6661-6663,6665-6666,6668-6669,6672-6673,6675,6677-6678,6680,6682-6686,6688-6717,6719,6721-6722,6724-6728,6730,6732-6734,6736-6739,6741,6743,6745-6746,6748-6756,6758-6762,6764,6766-6788,6790,6792-6798,6800-6814,6816-6819,6821-6822,6824-6826,6828-6837,6839,6841,6843-6849,6851,6853-6869,6871-6874,6876-6877,6879,6881,6883,6885-6886,6888-6893,6895-6897,6899-6901,6903,6905-6907,6909,6911-6929,6931-6936,6938-6947,6949,6951,6953,6955-6956,6958-6959,6961-6968,6970-6971,6973-6974,6976-6978,6980,6982-7017,7019-7025,7027-7035,7037-7039,7041-7045,7047-7055,7057,7059-7065,7067-7069,7071,7073,7075-7076,7078,7080-7081,7083,7085,7087,7089-7097,7099-7102,7104-7105,7107-7111,7113-7120,7122-7124,7126-7129,7131,7133-7141,7143,7145-7146
   + 
/trunk:6439-6441,6443,6445-6447,6449-6464,6466-6468,6470-6474,6476-6477,6479-6480,6483-6488,6490-6491,6493-6494,6496-6501,6503-6504,6506,6508,6510-6511,6513,6515-6516,6518,6520-6524,6526-6528,6533-6534,6536-6541,6543-6565,6567,6569,6571-6576,6578,6580-6586,6588-6596,6598-6600,6602-6604,6606-6607,6609-6611,6613-6625,6629-6639,6641-6643,6645-6646,6648,6650-6654,6656-6659,6661-6663,6665-6666,6668-6669,6672-6673,6675,6677-6678,6680,6682-6686,6688-6717,6719,6721-6722,6724-6728,6730,6732-6734,6736-6739,6741,6743,6745-6746,6748-6756,6758-6762,6764,6766-6788,6790,6792-6798,6800-6814,6816-6819,6821-6822,6824-6826,6828-6837,6839,6841,6843-6849,6851,6853-6869,6871-6874,6876-6877,6879,6881,6883,6885-6886,6888-6893,6895-6897,6899-6901,6903,6905-6907,6909,6911-6929,6931-6936,6938-6947,6949,6951,6953,6955-6956,6958-6959,6961-6968,6970-6971,6973-6974,6976-6978,6980,6982-7017,7019-7025,7027-7035,7037-7039,7041-7045,7047-7055,7057,7059-7065,7067-7069,7071,7073,7075-7076,7078,7080-7081,7083,7085,7087,7089-7097,7099-7102,7104-7105,7107-7111,7113-7120,7122-7124,7126-7129,7131,7133-7141,7143,7145-7146,7148-7150

Modified: branches/Version-1_0-branch/property/inc/class.borequest.inc.php
===================================================================
--- branches/Version-1_0-branch/property/inc/class.borequest.inc.php    
2011-03-30 10:50:47 UTC (rev 7150)
+++ branches/Version-1_0-branch/property/inc/class.borequest.inc.php    
2011-03-31 09:04:37 UTC (rev 7151)
@@ -393,6 +393,18 @@
                                $values['location_data'] 
=$this->solocation->read_single($values['location_code']);
                        }
 
+                       if(isset($values['consume']) && $values['consume'])
+                       {
+                               foreach ($values['consume'] as &$consume)
+                               {
+                                       $consume['date'] = 
$GLOBALS['phpgw']->common->show_date($consume['date'],'Y');
+                               }
+                       }
+                       else
+                       {
+                               $values['consume'] = array();
+                       }
+
                        if($values['tenant_id']>0)
                        {
                                
$tenant_data=$this->bocommon->read_single_tenant($values['tenant_id']);
@@ -529,6 +541,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['consume_date']        = 
phpgwapi_datetime::date_to_timestamp($request['consume_date']);
 
                        if(is_array($values_attribute))
                        {

Modified: branches/Version-1_0-branch/property/inc/class.sorequest.inc.php
===================================================================
--- branches/Version-1_0-branch/property/inc/class.sorequest.inc.php    
2011-03-30 10:50:47 UTC (rev 7150)
+++ branches/Version-1_0-branch/property/inc/class.sorequest.inc.php    
2011-03-31 09:04:37 UTC (rev 7151)
@@ -483,6 +483,21 @@
 
                                $location_code = $this->db->f('location_code');
                                $request['power_meter']         = 
$this->soproject->get_power_meter($location_code);
+
+                               $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())
+                               {
+                                       $request['consume'][] = 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)
+                                       );
+                               }
                        }
 
                        return $request;
@@ -657,6 +672,17 @@
                                $this->db->query("UPDATE fm_request SET 
$value_set WHERE id= '{$id}'",__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) "
+                                       . "VALUES ('"
+                                       . $id . "','"
+                                       . (int)$request['consume_value'] . "',"
+                                       . (int)$request['consume_date']. ","
+                                       . $this->account . ","
+                                       . time() . ")",__LINE__,__FILE__);
+                       }
+
                        if($this->db->transaction_commit())
                        {
                                $this->increment_request_id();
@@ -782,6 +808,25 @@
                                
$this->soproject->update_power_meter($request['power_meter'],$request['location_code'],$address);
                        }
 
+                       if($request['consume_value'] && 
$request['consume_date'])
+                       {
+                               $this->db->query("INSERT INTO 
fm_request_consume (request_id,amount,date,user_id,entry_date) "
+                                       . "VALUES ('"
+                                       . $request['id']. "','"
+                                       . (int)$request['consume_value'] . "',"
+                                       . (int)$request['consume_date']. ","
+                                       . $this->account . ","
+                                       . time() . ")",__LINE__,__FILE__);
+                       }
+
+                       if(isset($request['delete_consume']) && 
is_array($request['delete_consume']))
+                       {
+                               foreach ($request['delete_consume'] as 
$delete_consume)
+                               {
+                                       $this->db->query("DELETE FROM 
fm_request_consume WHERE id =" . (int)$delete_consume,__LINE__,__FILE__);       
                  
+                               }
+                       }
+
                        if($this->db->transaction_commit())
                        {
                                if ($old_status != $request['status'])
@@ -812,9 +857,10 @@
                {
                        $request_id = (int) $request_id;
                        $this->db->transaction_begin();
-                       $this->db->query("DELETE FROM fm_request WHERE 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__);
+                       $this->db->query("DELETE FROM fm_request WHERE id = 
{$request_id}",__LINE__,__FILE__);
                //      $this->db->query("DELETE FROM fm_origin WHERE 
destination = 'request' AND destination_id='" . $request_id . 
"'",__LINE__,__FILE__);
                        $this->interlink->delete_at_target('property', 
'.project.request', $request_id, $this->db);
                        $this->db->transaction_commit();

Modified: branches/Version-1_0-branch/property/inc/class.uirequest.inc.php
===================================================================
--- branches/Version-1_0-branch/property/inc/class.uirequest.inc.php    
2011-03-30 10:50:47 UTC (rev 7150)
+++ branches/Version-1_0-branch/property/inc/class.uirequest.inc.php    
2011-03-31 09:04:37 UTC (rev 7151)
@@ -962,6 +962,12 @@
                                        
$receipt['error'][]=array('msg'=>lang('Please select a status !'));
                                }
 
+                               if($values['consume_value'] && 
!$values['consume_date'])
+                               {
+                                       
$receipt['error'][]=array('msg'=>lang('Please select a date !'));
+                               }
+
+
                                if(isset($values['budget']) && 
$values['budget'] && !ctype_digit($values['budget']))
                                {
                                        
$receipt['error'][]=array('msg'=>lang('budget') . ': ' . lang('Please enter an 
integer !'));
@@ -1181,13 +1187,14 @@
                        }
 
                        $show_dates = 
isset($this->config->config_data['request_show_dates']) && 
$this->config->config_data['request_show_dates'] ? 1 : '';
+                       $jscal = CreateObject('phpgwapi.jscalendar');
                        if($show_dates)
                        {
-                               $jscal = CreateObject('phpgwapi.jscalendar');
                                $jscal->add_listener('values_start_date');
                                $jscal->add_listener('values_end_date');
                        }
 
+                       $jscal->add_listener('values_consume_date');
                        $msgbox_data = $this->bocommon->msgbox_data($receipt);
 
                        $link_file_data = array
@@ -1257,6 +1264,38 @@
                                                                                
                                array('key' => 
'delete_file','label'=>lang('Delete 
file'),'sortable'=>false,'resizeable'=>true,'formatter'=>'FormatterCenter')))
                                );
 
+
+
+                       if($this->acl_edit)
+                       {
+                               $lang_delete_consume = 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}'>";
+                               }
+                       }
+                       
+                       $datavalues[2] = array
+                               (
+                                       'name'                                  
=> "2",
+                                       'values'                                
=> json_encode($values['consume']),
+                                       'total_records'                 => 
count($values['consume']),
+                                       'edit_action'                   => "''",
+                                       'is_paginator'                  => 0,
+                                       'footer'                                
=> 0
+                               );
+
+
+
+                       $myColumnDefs[2] = array
+                               (
+                                       'name'          => "2",
+                                       '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)
@@ -1413,6 +1452,7 @@
 
                                        'condition_list'                        
                => $this->bo->select_conditions($id),
                                        'building_part_list'                    
        => array('options' => 
$this->bocommon->select_category_list(array('type'=> 'building_part','selected' 
=>$values['building_part'], 'order' => 'id', 'id_in_name' => 'num' ))),
+                                       'value_consume'                         
                => isset($receipt['error']) ? $values['consume_value'] : ''
                                );
 //_debug_array($data);die();
                        phpgwapi_yui::load_widget('dragdrop');

Modified: branches/Version-1_0-branch/property/js/yahoo/request.edit.js
===================================================================
--- branches/Version-1_0-branch/property/js/yahoo/request.edit.js       
2011-03-30 10:50:47 UTC (rev 7150)
+++ branches/Version-1_0-branch/property/js/yahoo/request.edit.js       
2011-03-31 09:04:37 UTC (rev 7151)
@@ -42,6 +42,11 @@
                elCell.innerHTML = "<center>"+oData+"</center>";
        }
        
+       var FormatterRight = function(elCell, oRecord, oColumn, oData)
+       {
+               elCell.innerHTML = "<div 
align=\"right\">"+YAHOO.util.Number.format(oData, {thousandsSeparator:" 
"})+"</div>";
+       }
+
 
/********************************************************************************/
 YAHOO.util.Event.addListener(window, "load", function()
 {

Modified: branches/Version-1_0-branch/property/setup/phpgw_no.lang
===================================================================
--- branches/Version-1_0-branch/property/setup/phpgw_no.lang    2011-03-30 
10:50:47 UTC (rev 7150)
+++ branches/Version-1_0-branch/property/setup/phpgw_no.lang    2011-03-31 
09:04:37 UTC (rev 7151)
@@ -348,6 +348,10 @@
 consequence    property        no      Konsekvens
 consequential damage   property        no      Følgeskader
 consume        property        no      forbruk
+consume date   property        no      Dato historisk forbruk
+consume value  property        no      Beløp historisk forbruk
+consume history        property        no      Historisk forbruk
+check to delete        property        no      Merk for å slette
 contact        property        no      Kontakt
 contact email  property        no      Epost
 contact phone  property        no      kontakt telefon

Modified: branches/Version-1_0-branch/property/setup/setup.inc.php
===================================================================
--- branches/Version-1_0-branch/property/setup/setup.inc.php    2011-03-30 
10:50:47 UTC (rev 7150)
+++ branches/Version-1_0-branch/property/setup/setup.inc.php    2011-03-31 
09:04:37 UTC (rev 7151)
@@ -12,7 +12,7 @@
        */
 
        $setup_info['property']['name']                 = 'property';
-       $setup_info['property']['version']              = '0.9.17.614';
+       $setup_info['property']['version']              = '0.9.17.615';
        $setup_info['property']['app_order']    = 8;
        $setup_info['property']['enable']               = 1;
        $setup_info['property']['app_group']    = 'office';
@@ -116,6 +116,7 @@
                'fm_request_condition',
                'fm_request_status',
                'fm_request_history',
+               'fm_request_consume',
                'fm_template',
                'fm_template_hours',
                'fm_chapter',

Modified: branches/Version-1_0-branch/property/setup/tables_current.inc.php
===================================================================
--- branches/Version-1_0-branch/property/setup/tables_current.inc.php   
2011-03-30 10:50:47 UTC (rev 7150)
+++ branches/Version-1_0-branch/property/setup/tables_current.inc.php   
2011-03-31 09:04:37 UTC (rev 7151)
@@ -834,6 +834,21 @@
                        'ix' => array(),
                        'uc' => array()
                ),
+               'fm_request_consume' => 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: branches/Version-1_0-branch/property/setup/tables_update.inc.php
===================================================================
--- branches/Version-1_0-branch/property/setup/tables_update.inc.php    
2011-03-30 10:50:47 UTC (rev 7150)
+++ branches/Version-1_0-branch/property/setup/tables_update.inc.php    
2011-03-31 09:04:37 UTC (rev 7151)
@@ -5165,7 +5165,43 @@
                }
        }
 
+       /**
+       * Update property version from 0.9.17.614 to 0.9.17.615
+       * Add historical consume to request
+       * 
+       */
 
+       $test[] = '0.9.17.614';
+       function property_upgrade0_9_17_614()
+       {
+               $GLOBALS['phpgw_setup']->oProc->m_odb->transaction_begin();
+
+               $GLOBALS['phpgw_setup']->oProc->CreateTable(
+                       'fm_request_consume', 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.615';
+                       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: branches/Version-1_0-branch/property/templates/base/request.xsl
===================================================================
--- branches/Version-1_0-branch/property/templates/base/request.xsl     
2011-03-30 10:50:47 UTC (rev 7150)
+++ branches/Version-1_0-branch/property/templates/base/request.xsl     
2011-03-31 09:04:37 UTC (rev 7151)
@@ -402,6 +402,43 @@
                                                                        </tr>
                                                                </xsl:when>
                                                        </xsl:choose>
+
+                                                       <tr>
+                                                               <td 
valign="top">
+                                                                               
<xsl:value-of select="php:function('lang', 'consume date')" />
+                                                               </td>
+                                                               <td>
+                                                                       <input 
type="text" id="values_consume_date" name="values[consume_date]" size="10" 
value="" readonly="readonly" >
+                                                                               
<xsl:attribute name="title">
+                                                                               
        <xsl:value-of select="php:function('lang', 'consume date')" />
+                                                                               
</xsl:attribute>
+                                                                       </input>
+                                                                       <img 
id="values_consume_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', 'consume value')" />
+                                                               </td>
+                                                               <td>
+                                                                       <input 
type="text" id="values_consume_value" name="values[consume_value]" size="10" 
value="{value_consume}" >
+                                                                               
<xsl:attribute name="title">
+                                                                               
        <xsl:value-of select="php:function('lang', 'consume 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', 'consume history')" />
+                                                                               
</td>
+                                                                               
<td>
+                                                                               
        <div id="datatable-container_2"></div>
+                                                                               
</td>
+                                                                       </tr>
+
 <!--
                                                        <tr>
                                                                <td 
valign="top">
@@ -448,6 +485,12 @@
                                                                                
<xsl:apply-templates select="table_header_importance"/>
                                                                                
<xsl:apply-templates select="condition_list"/>
                                                                                
<tr>
+                                                                               
        <td>
+                                                                               
                <br/>
+                                                                               
        </td>
+                                                                               
</tr>
+
+                                                                               
<tr>
                                                                                
        <td align="left">
                                                                                
                <xsl:value-of select="php:function('lang', 'Authorities 
Demands')" />
                                                                                
        </td>
@@ -462,8 +505,12 @@
                                                                                
                </select>                       
                                                                                
        </td>
                                                                                
</tr>
-
                                                                                
<tr>
+                                                                               
        <td>
+                                                                               
                <br/>
+                                                                               
        </td>
+                                                                               
</tr>
+                                                                               
<tr>
                                                                                
        <td valign='top' align="left">
                                                                                
                <xsl:value-of select="php:function('lang', 'regulations')" />
                                                                                
        </td>
@@ -514,6 +561,11 @@
                                                                                
</tr>
                                                                                
<xsl:call-template name="attributes"/>
                                                                                
<tr>
+                                                                               
        <td>
+                                                                               
                <br/>
+                                                                               
        </td>
+                                                                               
</tr>
+                                                                               
<tr>
                                                                                
        <td align="left">
                                                                                
                <xsl:value-of select="lang_score"/>
                                                                                
        </td>




reply via email to

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