fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [10620] property: fractions on periodizing outline


From: Sigurd Nes
Subject: [Fmsystem-commits] [10620] property: fractions on periodizing outline
Date: Sun, 23 Dec 2012 14:23:36 +0000

Revision: 10620
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=10620
Author:   sigurdne
Date:     2012-12-23 14:23:35 +0000 (Sun, 23 Dec 2012)
Log Message:
-----------
property: fractions on periodizing outline

Modified Paths:
--------------
    trunk/property/inc/class.sogeneric.inc.php
    trunk/property/inc/class.soproject.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

Modified: trunk/property/inc/class.sogeneric.inc.php
===================================================================
--- trunk/property/inc/class.sogeneric.inc.php  2012-12-23 13:29:22 UTC (rev 
10619)
+++ trunk/property/inc/class.sogeneric.inc.php  2012-12-23 14:23:35 UTC (rev 
10620)
@@ -2412,12 +2412,31 @@
                                                                'name'          
=> 'value',
                                                                'descr'         
=> lang('value'),
                                                                'type'          
=> 'numeric',
-                                                               'nullable'      
=> false,
+                                                               'nullable'      
=> true,
                                                                'size'          
=> 4,
                                                                'sortable'      
=> true
                                                        ),
                                                        array
                                                        (
+                                                               'name'          
=> 'dividend',
+                                                               'descr'         
=> lang('fraction::dividend'),
+                                                               'type'          
=> 'integer',
+                                                               'nullable'      
=> true,
+                                                               'size'          
=> 4,
+                                                               'sortable'      
=> true
+                                                       ),
+                                                       array
+                                                       (
+                                                               'name'          
=> 'divisor',
+                                                               'descr'         
=> lang('fraction::divisor'),
+                                                               'type'          
=> 'integer',
+                                                               'nullable'      
=> true,
+                                                               'size'          
=> 4,
+                                                               'sortable'      
=> true
+                                                       ),
+
+                                                       array
+                                                       (
                                                                'name' => 
'remark',
                                                                'descr' => 
lang('remark'),
                                                                'type' => 
'varchar',

Modified: trunk/property/inc/class.soproject.inc.php
===================================================================
--- trunk/property/inc/class.soproject.inc.php  2012-12-23 13:29:22 UTC (rev 
10619)
+++ trunk/property/inc/class.soproject.inc.php  2012-12-23 14:23:35 UTC (rev 
10620)
@@ -1585,13 +1585,15 @@
 
                        if($periodization_id)
                        {
-                               $this->db->query("SELECT month, value FROM 
fm_eco_periodization_outline WHERE periodization_id = {$periodization_id} ORDER 
BY month ASC",__LINE__,__FILE__);
+                               $this->db->query("SELECT month, 
value,dividend,divisor FROM fm_eco_periodization_outline WHERE periodization_id 
= {$periodization_id} ORDER BY month ASC",__LINE__,__FILE__);
                                while ($this->db->next_record())
                                {
                                        $periodization_outline[] = array
                                        (
                                                'month' => 
$this->db->f('month'),
                                                'value' => 
$this->db->f('value'),
+                                               'dividend' => 
$this->db->f('dividend'),
+                                               'divisor' => 
$this->db->f('divisor')
                                        );
                                }
                        }
@@ -1601,13 +1603,24 @@
                                (
                                        'month' => 0,
                                        'value' => 100,
+                                       'dividend' => 1,
+                                       'divisor' => 1,
+
                                );
                        
                        }
                        
                        foreach ($periodization_outline as $outline)
                        {
-                               $partial_budget = $budget * $outline['value'] / 
100;
+                               if ($outline['dividend'] && $outline['divisor'])
+                               {
+                                       $partial_budget = $budget * 
$outline['dividend'] / $outline['divisor'];                         
+                               }
+                               else
+                               {
+                                       $partial_budget = $budget * 
$outline['value'] / 100;                            
+                               }
+
                                $this->_update_budget($project_id, $year, 
$outline['month'], $partial_budget);
                        }
 

Modified: trunk/property/setup/phpgw_no.lang
===================================================================
--- trunk/property/setup/phpgw_no.lang  2012-12-23 13:29:22 UTC (rev 10619)
+++ trunk/property/setup/phpgw_no.lang  2012-12-23 14:23:35 UTC (rev 10620)
@@ -823,6 +823,8 @@
 formats        property        no      Formater
 forward        property        no      Videresend
 fraction       property        no      Fraksjon
+fraction::dividend     property        no      Brøk::teller
+fraction::divisor      property        no      Brøk::nevner
 from   property        no      Fra
 from date      property        no      Fra dato
 funding        property        no      Finansiering

Modified: trunk/property/setup/setup.inc.php
===================================================================
--- trunk/property/setup/setup.inc.php  2012-12-23 13:29:22 UTC (rev 10619)
+++ trunk/property/setup/setup.inc.php  2012-12-23 14:23:35 UTC (rev 10620)
@@ -12,7 +12,7 @@
        */
 
        $setup_info['property']['name']                 = 'property';
-       $setup_info['property']['version']              = '0.9.17.659';
+       $setup_info['property']['version']              = '0.9.17.660';
        $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 2012-12-23 13:29:22 UTC (rev 
10619)
+++ trunk/property/setup/tables_current.inc.php 2012-12-23 14:23:35 UTC (rev 
10620)
@@ -1309,6 +1309,8 @@
                                'periodization_id' => array('type' => 
'int','precision' => '4','nullable' => False),
                                'month' => array('type' => 'int','precision' => 
'4','nullable' => true),
                                'value' => array('type' => 
'decimal','precision' => '20','scale' => '6','nullable' => false,'default' => 
'0.000000'),
+                               'dividend' => array('type' => 'int','precision' 
=> '4','nullable' => true),
+                               'divisor' => array('type' => 'int','precision' 
=> '4','nullable' => true),
                                'remark' => array('type' => 
'varchar','precision' => '60','nullable' => False),
                        ),
                        'pk' => array('id'),

Modified: trunk/property/setup/tables_update.inc.php
===================================================================
--- trunk/property/setup/tables_update.inc.php  2012-12-23 13:29:22 UTC (rev 
10619)
+++ trunk/property/setup/tables_update.inc.php  2012-12-23 14:23:35 UTC (rev 
10620)
@@ -7114,3 +7114,44 @@
                        return $GLOBALS['setup_info']['property']['currentver'];
                }
        }
+       
+       /**
+       * Update property version from 0.9.17.659 to 0.9.17.660
+       * Add fraction to periodization outline as an alternative
+       */
+       $test[] = '0.9.17.659';
+       function property_upgrade0_9_17_659()
+       {
+               $GLOBALS['phpgw_setup']->oProc->m_odb->transaction_begin();
+       
+
+               
$GLOBALS['phpgw_setup']->oProc->AddColumn('fm_eco_periodization_outline','dividend',array(
+                       'type'          => 'int',
+                       'precision'     => 4,
+                       'nullable'      => true
+                       )
+               );
+
+               
$GLOBALS['phpgw_setup']->oProc->AddColumn('fm_eco_periodization_outline','divisor',array(
+                       'type'          => 'int',
+                       'precision'     => 4,
+                       'nullable'      => true
+                       )
+               );
+
+               
$GLOBALS['phpgw_setup']->oProc->AlterColumn('fm_eco_periodization_outline','value',array(
+                       'type'          => 'decimal',
+                       'precision'     => '20',
+                       'scale'         => '6',
+                       'nullable'      => true
+                       )
+               );
+
+               if($GLOBALS['phpgw_setup']->oProc->m_odb->transaction_commit())
+               {
+                       $GLOBALS['setup_info']['property']['currentver'] = 
'0.9.17.660';
+                       return $GLOBALS['setup_info']['property']['currentver'];
+               }
+       }
+       
+




reply via email to

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