fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [11814] property: tweak workorder approval and some m


From: Sigurd Nes
Subject: [Fmsystem-commits] [11814] property: tweak workorder approval and some more on budget handling
Date: Thu, 13 Mar 2014 20:26:23 +0000

Revision: 11814
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=11814
Author:   sigurdne
Date:     2014-03-13 20:26:22 +0000 (Thu, 13 Mar 2014)
Log Message:
-----------
property: tweak workorder approval and some more on budget handling

Modified Paths:
--------------
    trunk/property/inc/class.sodimb_role_user.inc.php
    trunk/property/inc/class.soworkorder.inc.php
    trunk/property/inc/class.uiproject.inc.php
    trunk/property/inc/class.uiworkorder.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/project.xsl
    trunk/property/templates/base/workorder.xsl

Modified: trunk/property/inc/class.sodimb_role_user.inc.php
===================================================================
--- trunk/property/inc/class.sodimb_role_user.inc.php   2014-03-13 14:58:22 UTC 
(rev 11813)
+++ trunk/property/inc/class.sodimb_role_user.inc.php   2014-03-13 20:26:22 UTC 
(rev 11814)
@@ -48,7 +48,9 @@
                {
                        $query_start =  
phpgwapi_datetime::date_to_timestamp($data['query_start']);
                        $query_end =  
phpgwapi_datetime::date_to_timestamp($data['query_end']);
+                       $get_netto_list = isset($data['get_netto_list']) && 
$data['get_netto_list'] ? true : false;
 
+
                        $dimb_id = (int) $data['dimb_id'];                      
                        if(isset($data['user_id']) && $data['user_id'])
                        {
@@ -119,6 +121,10 @@
                                );
                        }
 
+                       if($get_netto_list)
+                       {
+                               return $user_data;
+                       }
 
                        $sql = "SELECT id, name FROM fm_ecodimb_role 
{$filterrole} ORDER BY id ASC ";
                        $this->db->query($sql,__LINE__,__FILE__);

Modified: trunk/property/inc/class.soworkorder.inc.php
===================================================================
--- trunk/property/inc/class.soworkorder.inc.php        2014-03-13 14:58:22 UTC 
(rev 11813)
+++ trunk/property/inc/class.soworkorder.inc.php        2014-03-13 20:26:22 UTC 
(rev 11814)
@@ -886,7 +886,9 @@
                                        'approved'                              
 => $this->db->f('approved'),
                                        'mail_recipients'                => 
explode(',', trim($this->db->f('mail_recipients'), ',')),
                                        'actual_cost'                    => 
$this->db->f('actual_cost'),
-                                       'continuous'                     => 
$this->db->f('continuous')
+                                       'continuous'                     => 
$this->db->f('continuous'),
+                                       'fictive_periodization'  => 
$this->db->f('fictive_periodization'),
+
                                );
 
                                $sql = "SELECT periodization_id,"
@@ -1173,6 +1175,7 @@
                                $workorder['contract_sum'],
                                $workorder['approved'],
                                $workorder['continuous'],
+                               $workorder['fictive_periodization'],
                                isset($workorder['vendor_email']) && 
is_array($workorder['vendor_email']) ? implode(',', $workorder['vendor_email']) 
: ''
                        );
 
@@ -1180,7 +1183,7 @@
 
                        $this->db->query("INSERT INTO fm_workorder 
(id,num,project_id,title,access,entry_date,start_date,end_date,status,"
                        . 
"descr,budget,combined_cost,account_id,rig_addition,addition,key_deliver,key_fetch,vendor_id,charge_tenant,"
-                       . 
"user_id,ecodimb,category,billable_hours,contract_sum,approved,continuous,mail_recipients
  $cols) "
+                       . 
"user_id,ecodimb,category,billable_hours,contract_sum,approved,continuous,fictive_periodization,mail_recipients
  $cols) "
                        . "VALUES ( {$values} {$vals})", __LINE__, __FILE__);
 
                        $this->db->query("INSERT INTO fm_orders (id,type) 
VALUES ({$id},'workorder')");
@@ -1295,28 +1298,29 @@
 
                        $value_set = array
                        (
-                               'title'                          => 
$workorder['title'],
-                               'status'                         => 
$workorder['status'],
-                               'start_date'             => 
$workorder['start_date'],
-                               'end_date'                       => 
$workorder['end_date'],
-                               'descr'                          => 
$workorder['descr'],
-                               'budget'                         => (int) 
$workorder['budget'],
-//                             'combined_cost'         => $combined_cost,
-                               'key_deliver'            => 
$workorder['key_deliver'],
-                               'key_fetch'                      => 
$workorder['key_fetch'],
-                               'account_id'             => 
$workorder['b_account_id'],
-                               'rig_addition'           => 
$workorder['addition_rs'],
-                               'addition'                       => 
$workorder['addition_percentage'],
-                               'charge_tenant'          => 
$workorder['charge_tenant'],
-                               'vendor_id'                      => 
$workorder['vendor_id'],
-                               'user_id'                        => 
$workorder['user_id'],
-                               'ecodimb'                        => 
$workorder['ecodimb'],
-                               'category'                       => 
$workorder['cat_id'],
-                               'billable_hours'         => 
$workorder['billable_hours'],
-//                             'contract_sum'          => 
$workorder['contract_sum'],
-                               'approved'                       => 
$workorder['approved'],
-                               'continuous'             => 
$workorder['continuous'],
-                               'mail_recipients'        => 
isset($workorder['vendor_email']) && is_array($workorder['vendor_email']) ? 
implode(',', $workorder['vendor_email']) : '',
+                               'title'                                  => 
$workorder['title'],
+                               'status'                                 => 
$workorder['status'],
+                               'start_date'                     => 
$workorder['start_date'],
+                               'end_date'                               => 
$workorder['end_date'],
+                               'descr'                                  => 
$workorder['descr'],
+                               'budget'                                 => 
(int) $workorder['budget'],
+//                             'combined_cost'                 => 
$combined_cost,
+                               'key_deliver'                    => 
$workorder['key_deliver'],
+                               'key_fetch'                              => 
$workorder['key_fetch'],
+                               'account_id'                     => 
$workorder['b_account_id'],
+                               'rig_addition'                   => 
$workorder['addition_rs'],
+                               'addition'                               => 
$workorder['addition_percentage'],
+                               'charge_tenant'                  => 
$workorder['charge_tenant'],
+                               'vendor_id'                              => 
$workorder['vendor_id'],
+                               'user_id'                                => 
$workorder['user_id'],
+                               'ecodimb'                                => 
$workorder['ecodimb'],
+                               'category'                               => 
$workorder['cat_id'],
+                               'billable_hours'                 => 
$workorder['billable_hours'],
+//                             'contract_sum'                  => 
$workorder['contract_sum'],
+                               'approved'                               => 
$workorder['approved'],
+                               'continuous'                     => 
$workorder['continuous'],
+                               'fictive_periodization'  => 
$workorder['fictive_periodization'],
+                               'mail_recipients'                => 
isset($workorder['vendor_email']) && is_array($workorder['vendor_email']) ? 
implode(',', $workorder['vendor_email']) : '',
                        );
 
 
@@ -1794,7 +1798,7 @@
                        $sum_year_combined_cost  = array();
 
                        $sql = "SELECT continuous, fm_workorder.start_date , 
fm_workorder_budget.budget, fm_workorder_budget.combined_cost,"
-                       . " project_type_id, year, month, active, closed"
+                       . " project_type_id, year, month, active, closed, 
fictive_periodization"
                        . " FROM fm_workorder"
                        . " {$this->join} fm_project ON fm_workorder.project_id 
= fm_project.id"
                        . " {$this->join} fm_workorder_status ON 
fm_workorder.status = fm_workorder_status.id"
@@ -1807,11 +1811,12 @@
                        $_order_budget                   = array();
                        while($this->db->next_record())
                        {
-                               $project_type_id        = (int) 
$this->db->f('project_type_id');
-                               $year                           = (int) 
$this->db->f('year');
-                               $month                          = (int) 
$this->db->f('month');
-                               $continuous                     = 
!!$this->db->f('continuous');
-                               $period                         = 
sprintf("%s%02d", $year, $month
+                               $fictive_periodization  = 
!!$this->db->f('fictive_periodization');
+                               $project_type_id                = (int) 
$this->db->f('project_type_id');
+                               $year                                   = (int) 
$this->db->f('year');
+                               $month                                  = (int) 
$this->db->f('month');
+                               $continuous                             = 
!!$this->db->f('continuous');
+                               $period                                 = 
sprintf("%s%02d", $year, $month
                                );
 
                                $budget                                  = 
(int) $this->db->f('budget');
@@ -1854,6 +1859,7 @@
                         * ellers: Start-periode blir måned for start-dato for 
bestilling dersom den ligger frem i tid
                         * ellers: Dersom start-dato for bestilling er passert 
- blir start-periode inneværende måned.
                         * */
+                       $calculate_fictive_periods = $fictive_periodization ? 
$calculate_fictive_periods : false;
                        $fictive_period                                         
 = array();
                        $exclude_from_fictive_period             = array();
                        $exclude_year_from_fictive_period        = array();

Modified: trunk/property/inc/class.uiproject.inc.php
===================================================================
--- trunk/property/inc/class.uiproject.inc.php  2014-03-13 14:58:22 UTC (rev 
11813)
+++ trunk/property/inc/class.uiproject.inc.php  2014-03-13 20:26:22 UTC (rev 
11814)
@@ -1686,13 +1686,30 @@
                                if(isset($config->config_data['invoice_acl']) 
&& $config->config_data['invoice_acl'] == 'dimb')
                                {
                                        $supervisor_id = 
$invoice->get_default_dimb_role_user(2, $values['ecodimb']);
-                                       $prefs = 
$this->bocommon->create_preferences('property',$supervisor_id);
-                                       $supervisor_email[] = array
-                                       (
-                                               'id'      => $supervisor_id,
-                                               'address' => $prefs['email'],
+
+                                       $sodimb_role_users = 
execMethod('property.sodimb_role_user.read', array
+                                                       (
+                                                               'dimb_id'       
                => $values['ecodimb'],
+                                                               'role_id'       
                => 2,
+                                                               'query_start'   
        => 
date($GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']),
+                                                               
'get_netto_list'        => true
+                                                       )
                                        );
+                                       if( 
isset($sodimb_role_users[$values['ecodimb']][2]) && 
is_array($sodimb_role_users[$values['ecodimb']][2]))
+                                       {
+                                               
foreach($sodimb_role_users[$values['ecodimb']][2] as $supervisor_id => $entry)
+                                               {
+                                                       $prefs = 
$this->bocommon->create_preferences('property',$supervisor_id);
+                                                       $supervisor_email[] = 
array
+                                                       (
+                                                               'id'      => 
$supervisor_id,
+                                                               'address' => 
$prefs['email'],
+                                                               'default'       
=> $entry['default_user'],
+                                                       );
 
+                                               }
+                                       }
+
                                        $supervisor2_id = 
$invoice->get_default_dimb_role_user(3, $values['ecodimb']);
                                        $prefs2 = 
$this->bocommon->create_preferences('property', $supervisor2_id);
                                        $supervisor_email[] = array
@@ -1700,7 +1717,7 @@
                                                'id'      => $supervisor2_id,
                                                'address' => $prefs2['email'],
                                        );
-                                       $supervisor_email = 
array_reverse($supervisor_email);
+//                                     $supervisor_email = 
array_reverse($supervisor_email);
                                        unset($prefs);
                                        unset($prefs2);
                                        unset($invoice);

Modified: trunk/property/inc/class.uiworkorder.inc.php
===================================================================
--- trunk/property/inc/class.uiworkorder.inc.php        2014-03-13 14:58:22 UTC 
(rev 11813)
+++ trunk/property/inc/class.uiworkorder.inc.php        2014-03-13 20:26:22 UTC 
(rev 11814)
@@ -1619,14 +1619,32 @@
                                $invoice        = 
CreateObject('property.soinvoice');
                                if(isset($config->config_data['invoice_acl']) 
&& $config->config_data['invoice_acl'] == 'dimb')
                                {
-                                       $supervisor_id = 
$invoice->get_default_dimb_role_user(2, $values['ecodimb']);
-                                       $prefs = 
$this->bocommon->create_preferences('property',$supervisor_id);
-                                       $supervisor_email[] = array
-                                       (
-                                               'id'      => $supervisor_id,
-                                               'address' => $prefs['email'],
+
+                                       $sodimb_role_users = 
execMethod('property.sodimb_role_user.read', array
+                                                       (
+                                                               'dimb_id'       
                => $values['ecodimb'],
+                                                               'role_id'       
                => 2,
+                                                               'query_start'   
        => 
date($GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']),
+                                                               
'get_netto_list'        => true
+                                                       )
                                        );
+                                       if( 
isset($sodimb_role_users[$values['ecodimb']][2]) && 
is_array($sodimb_role_users[$values['ecodimb']][2]))
+                                       {
+                                               
foreach($sodimb_role_users[$values['ecodimb']][2] as $supervisor_id => $entry)
+                                               {
+                                                       $prefs = 
$this->bocommon->create_preferences('property',$supervisor_id);
+                                                       $supervisor_email[] = 
array
+                                                       (
+                                                               'id'      => 
$supervisor_id,
+                                                               'address' => 
$prefs['email'],
+                                                               'default'       
=> $entry['default_user'],
+                                                       );
 
+                                               }
+                                       }
+
+//                                     $supervisor_id = 
$invoice->get_default_dimb_role_user(2, $values['ecodimb']);
+
                                        $supervisor2_id = 
$invoice->get_default_dimb_role_user(3, $values['ecodimb']);
                                        $prefs2 = 
$this->bocommon->create_preferences('property', $supervisor2_id);
                                        $supervisor_email[] = array
@@ -2189,6 +2207,7 @@
 
                                'value_approved'                                
                => isset($values['approved']) ? $values['approved'] : '',
                                'value_continuous'                              
                => isset($values['continuous']) ? $values['continuous'] : '',
+                               'value_fictive_periodization'                   
=> isset($values['fictive_periodization']) ? $values['fictive_periodization'] : 
'',
                                'need_approval'                                 
                => $need_approval,
                                'lang_ask_approval'                             
                => lang('Ask for approval'),
                                'lang_ask_approval_statustext'                  
=> lang('Check this to send a mail to your supervisor for approval'),

Modified: trunk/property/setup/phpgw_no.lang
===================================================================
--- trunk/property/setup/phpgw_no.lang  2014-03-13 14:58:22 UTC (rev 11813)
+++ trunk/property/setup/phpgw_no.lang  2014-03-13 20:26:22 UTC (rev 11814)
@@ -1105,6 +1105,7 @@
 muliple radio  property        no      Flervalgs radioknapp
 multiple checkbox      property        no      Flervalgs avkrysningsknapp
 multiple radio property        no      Flervalgs radioknapp
+multiplier     property        no      Skaleringsfaktor
 my preferences property        no      Mine innstillinger
 my assigned tickets    property        no      Mine tildelte meldinger
 my submitted tickets   property        no      Mine innmeldte meldinger
@@ -2021,3 +2022,4 @@
 cost investment        property        no      Andel investering i kr.
 grant category property        no      Tilskuddskategori
 what   property        no      Hva
+fictive periodization  property        no      Periodiser løpende ut året
\ No newline at end of file

Modified: trunk/property/setup/setup.inc.php
===================================================================
--- trunk/property/setup/setup.inc.php  2014-03-13 14:58:22 UTC (rev 11813)
+++ trunk/property/setup/setup.inc.php  2014-03-13 20:26:22 UTC (rev 11814)
@@ -12,7 +12,7 @@
        */
 
        $setup_info['property']['name']                 = 'property';
-       $setup_info['property']['version']              = '0.9.17.677';
+       $setup_info['property']['version']              = '0.9.17.678';
        $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 2014-03-13 14:58:22 UTC (rev 
11813)
+++ trunk/property/setup/tables_current.inc.php 2014-03-13 20:26:22 UTC (rev 
11814)
@@ -532,6 +532,7 @@
                                'approved'      => array('type' => 
'int','precision' => 2, 'nullable' => True),
                                'mail_recipients' => array('type' => 
'varchar','precision' => 255, 'nullable' => True),
                                'continuous'    => array('type' => 
'int','precision' => 2, 'nullable' => True),
+                               'fictive_periodization' => array('type' => 
'int','precision' => 2, 'nullable' => True),
                        ),
                        'pk' => array('id'),
                        'fk' => array(),

Modified: trunk/property/setup/tables_update.inc.php
===================================================================
--- trunk/property/setup/tables_update.inc.php  2014-03-13 14:58:22 UTC (rev 
11813)
+++ trunk/property/setup/tables_update.inc.php  2014-03-13 20:26:22 UTC (rev 
11814)
@@ -7877,12 +7877,12 @@
 
                $GLOBALS['phpgw_setup']->oProc->query("DELETE FROM fm_cache");
 
-               $sql = 'CREATE OR REPLACE VIEW fm_orders_paid_or_pending_view 
AS 
+               $sql = 'CREATE OR REPLACE VIEW fm_orders_paid_or_pending_view AS
                 SELECT orders_paid_or_pending.order_id, 
orders_paid_or_pending.periode,orders_paid_or_pending.amount,orders_paid_or_pending.periodization,
 orders_paid_or_pending.periodization_start
                   FROM ( SELECT fm_ecobilagoverf.pmwrkord_code AS order_id, 
fm_ecobilagoverf.periode, sum(fm_ecobilagoverf.godkjentbelop) AS amount, 
fm_ecobilagoverf.periodization, fm_ecobilagoverf.periodization_start
                               FROM fm_ecobilagoverf
                               GROUP BY fm_ecobilagoverf.pmwrkord_code, 
fm_ecobilagoverf.periode, fm_ecobilagoverf.periodization, 
fm_ecobilagoverf.periodization_start
-                               UNION ALL 
+                               UNION ALL
                              SELECT fm_ecobilag.pmwrkord_code AS order_id, 
fm_ecobilag.periode, sum(fm_ecobilag.godkjentbelop) AS amount, 
fm_ecobilag.periodization, fm_ecobilag.periodization_start
                               FROM fm_ecobilag
                               GROUP BY fm_ecobilag.pmwrkord_code, 
fm_ecobilag.periode, fm_ecobilag.periodization, 
fm_ecobilag.periodization_start) orders_paid_or_pending ORDER BY 
orders_paid_or_pending.periode, orders_paid_or_pending.order_id';
@@ -7896,3 +7896,25 @@
                }
        }
 
+       /**
+       * Update property version from 0.9.17.677 to 0.9.17.678
+       * Add fields to view
+       */
+
+       $test[] = '0.9.17.677';
+       function property_upgrade0_9_17_677()
+       {
+               $GLOBALS['phpgw_setup']->oProc->m_odb->transaction_begin();
+               
$GLOBALS['phpgw_setup']->oProc->AddColumn('fm_workorder','fictive_periodization',array(
+                       'type'          => 'int',
+                       'precision'     => 2,
+                       'nullable'      => True
+                       )
+               );
+
+               if($GLOBALS['phpgw_setup']->oProc->m_odb->transaction_commit())
+               {
+                       $GLOBALS['setup_info']['property']['currentver'] = 
'0.9.17.678';
+                       return $GLOBALS['setup_info']['property']['currentver'];
+               }
+       }
\ No newline at end of file

Modified: trunk/property/templates/base/project.xsl
===================================================================
--- trunk/property/templates/base/project.xsl   2014-03-13 14:58:22 UTC (rev 
11813)
+++ trunk/property/templates/base/project.xsl   2014-03-13 20:26:22 UTC (rev 
11814)
@@ -293,7 +293,10 @@
                                                                <xsl:value-of 
select="//lang_ask_approval_statustext"/>
                                                            </xsl:attribute>
                                                        </input>
-                                                   </td>
+                                                       <xsl:if test="default = 
'1'">
+                                                               
<xsl:text>&lt;=</xsl:text>
+                                                       </xsl:if>
+                                                       </td>
                                                </tr>
                                            </xsl:for-each>
                                        </table>

Modified: trunk/property/templates/base/workorder.xsl
===================================================================
--- trunk/property/templates/base/workorder.xsl 2014-03-13 14:58:22 UTC (rev 
11813)
+++ trunk/property/templates/base/workorder.xsl 2014-03-13 20:26:22 UTC (rev 
11814)
@@ -420,6 +420,9 @@
                                                                                
                                                        <xsl:value-of 
select="//lang_ask_approval_statustext"/>
                                                                                
                                                </xsl:attribute>
                                                                                
                                        </input>
+                                                                               
                                        <xsl:if test="default = '1'">
+                                                                               
                                                <xsl:text>&lt;=</xsl:text>
+                                                                               
                                        </xsl:if>
                                                                                
                                </td>
                                                                                
                        </tr>
                                                                                
                </xsl:for-each>
@@ -588,6 +591,31 @@
                                                                        </input>
                                                                </td>
                                                        </tr>
+                                                       <tr>
+                                                               <xsl:variable 
name="lang_fictive_periodization">
+                                                                       
<xsl:value-of select="php:function('lang', 'fictive periodization')"/>
+                                                               </xsl:variable>
+                                                               <td 
valign="top">
+                                                                       
<xsl:value-of select="$lang_fictive_periodization"/>
+                                                               </td>
+                                                               <td>
+                                                                       <input 
type="checkbox" name="values[fictive_periodization]" value="1">
+                                                                               
<xsl:attribute name="title">
+                                                                               
        <xsl:value-of select="$lang_fictive_periodization"/>
+                                                                               
</xsl:attribute>
+                                                                               
<xsl:if test="value_fictive_periodization = '1'">
+                                                                               
        <xsl:attribute name="checked">
+                                                                               
                <xsl:text>checked</xsl:text>
+                                                                               
        </xsl:attribute>
+                                                                               
</xsl:if>
+                                                                               
<xsl:if test="mode != 'edit'">
+                                                                               
        <xsl:attribute name="disabled">
+                                                                               
                <xsl:text>disabled</xsl:text>
+                                                                               
        </xsl:attribute>
+                                                                               
</xsl:if>
+                                                                       </input>
+                                                               </td>
+                                                       </tr>
 
                                                        <tr>
                                                                <td 
valign="top">




reply via email to

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