fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [16604] more on integration


From: sigurdne
Subject: [Fmsystem-commits] [16604] more on integration
Date: Thu, 20 Apr 2017 10:53:00 -0400 (EDT)

Revision: 16604
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=16604
Author:   sigurdne
Date:     2017-04-20 10:53:00 -0400 (Thu, 20 Apr 2017)
Log Message:
-----------
more on integration

Modified Paths:
--------------
    trunk/property/inc/class.bodimb_role_user.inc.php
    trunk/property/inc/class.botts.inc.php
    trunk/property/inc/class.menu.inc.php
    trunk/property/inc/class.sodimb_role_user.inc.php
    trunk/property/inc/class.uidimb_role_user.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/config.tpl

Added Paths:
-----------
    trunk/property/templates/base/role_user_substitute.xsl

Modified: trunk/property/inc/class.bodimb_role_user.inc.php
===================================================================
--- trunk/property/inc/class.bodimb_role_user.inc.php   2017-04-20 14:50:58 UTC 
(rev 16603)
+++ trunk/property/inc/class.bodimb_role_user.inc.php   2017-04-20 14:53:00 UTC 
(rev 16604)
@@ -69,4 +69,14 @@
                        $values = $this->so->edit($data);
                        return $values;
                }
+
+               public function update_substitute( $user_id, 
$substitute_user_id )
+               {
+                       return $this->so->update_substitute($user_id, 
$substitute_user_id);
+               }
+
+               public function get_substitute( $user_id)
+               {
+                       return $this->so->get_substitute($user_id);
+               }
        }
\ No newline at end of file

Modified: trunk/property/inc/class.botts.inc.php
===================================================================
--- trunk/property/inc/class.botts.inc.php      2017-04-20 14:50:58 UTC (rev 
16603)
+++ trunk/property/inc/class.botts.inc.php      2017-04-20 14:53:00 UTC (rev 
16604)
@@ -1821,7 +1821,15 @@
                                return array();
                        }
                        $approval_amount_limit = 
!empty($this->config->config_data['approval_amount_limit']) ? (int) 
$this->config->config_data['approval_amount_limit'] : 0;
+                       $approval_amount_limit2 = 
!empty($this->config->config_data['approval_amount_limit2']) ? (int) 
$this->config->config_data['approval_amount_limit2'] : 0;
 
+                       $approval_amount_limit1 = 0;
+                       if($approval_amount_limit2)
+                       {
+                               $approval_amount_limit1 = 
$approval_amount_limit;
+                               $approval_amount_limit = 0;
+                       }
+
                        $config         = CreateObject('admin.soconfig', 
$GLOBALS['phpgw']->locations->get_id('property', '.ticket'));
                        $check_external_register= 
!!$config->config_data['external_register']['check_external_register'];
                        $supervisors = array();
@@ -1940,7 +1948,28 @@
                                        unset($prefs);
                                }
                        }
+                       else if($approval_amount_limit1 > 0 && $amount > 
$approval_amount_limit1)
+                       {
+                               $invoice = CreateObject('property.soinvoice');
+                               $level_1_required = true;
 
+                               if($approval_amount_limit2 > 0 && $amount > 
$approval_amount_limit2)
+                               {
+                                       $supervisor_id = 
$invoice->get_default_dimb_role_user(2, $ecodimb);
+                                       if($supervisor_id)
+                                       {
+                                               $supervisors[$supervisor_id] =  
array('id' => $supervisor_id, 'required' => true, 'default' => true);
+                                               $level_1_required = false;
+                                       }
+                               }
+
+                               $supervisor_id = 
$invoice->get_default_dimb_role_user(1, $ecodimb);
+                               if($supervisor_id)
+                               {
+                                       $supervisors[$supervisor_id] =  
array('id' => $supervisor_id, 'required' => $level_1_required, 'default' => 
$level_1_required);
+                               }
+                       }
+
 //                     if(!$check_external_register && 
!empty($GLOBALS['phpgw_info']['user']['preferences']['property']['approval_from'])
 //                             && 
empty($supervisors[$GLOBALS['phpgw_info']['user']['preferences']['property']['approval_from']]))
 //                     {

Modified: trunk/property/inc/class.menu.inc.php
===================================================================
--- trunk/property/inc/class.menu.inc.php       2017-04-20 14:50:58 UTC (rev 
16603)
+++ trunk/property/inc/class.menu.inc.php       2017-04-20 14:53:00 UTC (rev 
16604)
@@ -334,12 +334,12 @@
                                          'url' => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'admin.uicategories.index', 'appname' => 'property', 'location' => 
'.invoice.dimb', 'global_cats' => 'true', 'menu_selection' => 
'admin::property::accounting::dimb_roles') )
                                          ),
                                         */
-                                       /*
+                                       
                                          'dimb_role'   => array
                                          (
                                          'text'        => lang('dimb roles'),
                                          'url' => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'property.uigeneric.index', 'type' => 'dimb_role') )
-                                         ),
+                                         ),/*
                                          'dimb_role_user' => array
                                          (
                                          'text'        => lang('dimb role 
user'),
@@ -787,17 +787,20 @@
                        {
                                $menus['preferences'] = array
                                        (
-                                       array
-                                               (
+                                       array(
                                                'text' => 
$GLOBALS['phpgw']->translation->translate('Preferences', array(), true),
                                                'url' => 
$GLOBALS['phpgw']->link('/preferences/preferences.php', array('appname' => 
'property',
                                                        'type' => 'user'))
                                        ),
-                                       array
-                                               (
+                                       array(
                                                'text' => 
$GLOBALS['phpgw']->translation->translate('Grant Access', array(), true),
                                                'url' => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'property.uiadmin.aclprefs',
                                                        'acl_app' => 
'property'))
+                                       ),
+                                       array(
+                                               'text' => lang('substitute'),
+                                               'url' => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'property.uidimb_role_user.substitute',
+                                                       'acl_app' => 
'property'))
                                        )
                                );
 

Modified: trunk/property/inc/class.sodimb_role_user.inc.php
===================================================================
--- trunk/property/inc/class.sodimb_role_user.inc.php   2017-04-20 14:50:58 UTC 
(rev 16603)
+++ trunk/property/inc/class.sodimb_role_user.inc.php   2017-04-20 14:53:00 UTC 
(rev 16604)
@@ -303,4 +303,15 @@
 
                        return $ok;
                }
+
+               public function update_substitute( $user_id, 
$substitute_user_id )
+               {
+                       return true;
+               }
+
+               public function get_substitute( $user_id)
+               {
+                       return 6;
+               }
+
        }
\ No newline at end of file

Modified: trunk/property/inc/class.uidimb_role_user.inc.php
===================================================================
--- trunk/property/inc/class.uidimb_role_user.inc.php   2017-04-20 14:50:58 UTC 
(rev 16603)
+++ trunk/property/inc/class.uidimb_role_user.inc.php   2017-04-20 14:53:00 UTC 
(rev 16604)
@@ -45,6 +45,7 @@
                        'index' => true,
                        'query' => true,
                        'edit' => true,
+                       'substitute' => true
                );
 
                function __construct()
@@ -305,4 +306,62 @@
                                        'user_id' => $user_id, 'dimb_id' => 
$dimb_id, 'role_id' => $role_id, 'query' => $query));
                        }
                }
+
+               public function substitute()
+               {
+                       $user_id = $this->account_id;
+                       $substitute_user_id = 
phpgw::get_var('substitute_user_id', 'int', 'POST');
+
+                       if($substitute_user_id)
+                       {
+                               $this->bo->update_substitute($user_id, 
$substitute_user_id);
+                       }
+
+                       $selected = $this->bo->get_substitute($user_id);
+
+                       $appname = lang('substitute');
+                       $function_msg = lang('set substitute');
+                       $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang('property') . ' - ' . $appname . ': ' . $function_msg;
+                       
$GLOBALS['phpgw']->xslttpl->add_file(array('role_user_substitute'));
+
+                       $data = array
+                       (
+                               'form_action' => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'property.uidimb_role_user.substitute')),
+                               'user_list' => array('options' => 
$this->_get_user_list($selected)),
+                       );
+
+                       $GLOBALS['phpgw']->xslttpl->set_var('phpgw', 
array('edit' => $data));
+               }
+
+               private function _get_user_list($selected)
+               {
+                       $users = 
$GLOBALS['phpgw']->acl->get_user_list_right(PHPGW_ACL_EDIT, '.project', 
'property');
+                       $user_list = array();
+                       $selected_found = false;
+                       foreach ($users as $user)
+                       {
+                               $name = (isset($user['account_lastname']) ? 
$user['account_lastname'] . ' ' : '') . $user['account_firstname'];
+                               $user_list[] = array(
+                                       'id' => $user['account_id'],
+                                       'name' => $name,
+                                       'selected' => $user['account_id'] == 
$selected ? 1 : 0
+                               );
+
+                               if (!$selected_found)
+                               {
+                                       $selected_found = $user['account_id'] 
== $selected ? true : false;
+                               }
+                       }
+                       if ($selected && !$selected_found)
+                       {
+                               $user_list[] = array
+                                       (
+                                       'id' => $selected,
+                                       'name' => 
$GLOBALS['phpgw']->accounts->get($selected)->__toString(),
+                                       'selected' => 1
+                               );
+                       }
+                       return $user_list;
+               }
+
        }
\ No newline at end of file

Modified: trunk/property/setup/phpgw_no.lang
===================================================================
--- trunk/property/setup/phpgw_no.lang  2017-04-20 14:50:58 UTC (rev 16603)
+++ trunk/property/setup/phpgw_no.lang  2017-04-20 14:53:00 UTC (rev 16604)
@@ -2104,4 +2104,6 @@
 profile        property        no      Profil
 new attribute  property        no      Ny attributt
 report property        no      Rapport
-canceled       property        no      Kansellert
\ No newline at end of file
+canceled       property        no      Kansellert
+substitute     property        no      Vikar
+set substitute property        no      Sett vikar
\ No newline at end of file

Modified: trunk/property/setup/setup.inc.php
===================================================================
--- trunk/property/setup/setup.inc.php  2017-04-20 14:50:58 UTC (rev 16603)
+++ trunk/property/setup/setup.inc.php  2017-04-20 14:53:00 UTC (rev 16604)
@@ -11,7 +11,7 @@
         * @version $Id$
        */
        $setup_info['property']['name']                 = 'property';
-       $setup_info['property']['version']              = '0.9.17.711';
+       $setup_info['property']['version']              = '0.9.17.712';
        $setup_info['property']['app_order']    = 8;
        $setup_info['property']['enable']               = 1;
        $setup_info['property']['app_group']    = 'office';
@@ -153,6 +153,7 @@
                'fm_ecodimb',
                'fm_ecodimb_role',
                'fm_ecodimb_role_user',
+               'fm_ecodimb_role_user_substitute',
                'fm_ecodimd',
                'fm_ecologg',
                'fm_ecomva',

Modified: trunk/property/setup/tables_current.inc.php
===================================================================
--- trunk/property/setup/tables_current.inc.php 2017-04-20 14:50:58 UTC (rev 
16603)
+++ trunk/property/setup/tables_current.inc.php 2017-04-20 14:53:00 UTC (rev 
16604)
@@ -1495,6 +1495,16 @@
                                        'ecodimb' => 'id'), 'phpgw_accounts' => 
array('user_id' => 'account_id')),
                        'uc' => array()
                ),
+               'fm_ecodimb_role_user_substitute' => array(
+                       'fd' => array(
+                               'user_id' => array('type' => 'int', 'precision' 
=> '4', 'nullable' => False),
+                               'substitute_user_id' => array('type' => 'int', 
'precision' => '4', 'nullable' => False),
+                       ),
+                       'pk' => array('user_id', 'substitute_user_id'),
+                       'ix' => array(),
+                       'fk' => array(),
+                       'uc' => array()
+               ),
                'fm_ecodimd' => array(
                        'fd' => array(
                                'id' => array('type' => 'varchar', 'precision' 
=> '5', 'nullable' => False),

Modified: trunk/property/setup/tables_update.inc.php
===================================================================
--- trunk/property/setup/tables_update.inc.php  2017-04-20 14:50:58 UTC (rev 
16603)
+++ trunk/property/setup/tables_update.inc.php  2017-04-20 14:53:00 UTC (rev 
16604)
@@ -9459,7 +9459,7 @@
        }
 
        /**
-       * Update property version from 0.9.17.709 to 0.9.17.711
+       * Update property version from 0.9.17.710 to 0.9.17.711
        *
        */
        $test[] = '0.9.17.710';
@@ -9513,3 +9513,34 @@
                        return $GLOBALS['setup_info']['property']['currentver'];
                }
        }
+
+       /**
+       * Update property version from 0.9.17.711 to 0.9.17.712
+       *
+       */
+       $test[] = '0.9.17.711';
+
+       function property_upgrade0_9_17_711()
+       {
+               $GLOBALS['phpgw_setup']->oProc->m_odb->transaction_begin();
+               $GLOBALS['phpgw']->locations->add('.report', 'Generic report', 
'property', $allow_grant = true);
+
+               $GLOBALS['phpgw_setup']->oProc->CreateTable(
+                       'fm_ecodimb_role_user_substitute', array(
+                               'fd' => array(
+                                       'user_id' => array('type' => 'int', 
'precision' => '4', 'nullable' => False),
+                                       'substitute_user_id' => array('type' => 
'int', 'precision' => '4', 'nullable' => False),
+                               ),
+                               'pk' => array('user_id', 'substitute_user_id'),
+                               'ix' => array(),
+                               'fk' => array(),
+                               'uc' => array()
+                       )
+               );
+
+               if($GLOBALS['phpgw_setup']->oProc->m_odb->transaction_commit())
+               {
+                       $GLOBALS['setup_info']['property']['currentver'] = 
'0.9.17.712';
+                       return $GLOBALS['setup_info']['property']['currentver'];
+               }
+       }

Modified: trunk/property/templates/base/config.tpl
===================================================================
--- trunk/property/templates/base/config.tpl    2017-04-20 14:50:58 UTC (rev 
16603)
+++ trunk/property/templates/base/config.tpl    2017-04-20 14:53:00 UTC (rev 
16604)
@@ -129,6 +129,12 @@
                                </td>
                        </tr>
                        <tr>
+                               <td>{lang_approval_amount_limit} 2:</td>
+                               <td>
+                                       <input 
name="newsettings[approval_amount_limit2]" 
value="{value_approval_amount_limit2}">
+                               </td>
+                       </tr>
+                       <tr>
                                <td>{lang_approval_level}:</td>
                                <td>
                                        <select 
name="newsettings[approval_level]">

Added: trunk/property/templates/base/role_user_substitute.xsl
===================================================================
--- trunk/property/templates/base/role_user_substitute.xsl                      
        (rev 0)
+++ trunk/property/templates/base/role_user_substitute.xsl      2017-04-20 
14:53:00 UTC (rev 16604)
@@ -0,0 +1,68 @@
+
+<!-- $Id: tts.xsl 16389 2017-02-28 17:35:22Z sigurdne $ -->
+
+<xsl:template match="data">
+       <xsl:choose>
+               <xsl:when test="view">
+                       <xsl:apply-templates select="edit"/>
+               </xsl:when>
+       </xsl:choose>
+       <xsl:call-template name="jquery_phpgw_i18n"/>
+</xsl:template>
+
+
+
+<!-- edit -->
+<xsl:template xmlns:php="http://php.net/xsl"; match="edit">
+       <xsl:variable name="form_action">
+               <xsl:value-of select="form_action"/>
+       </xsl:variable>
+       <form class="pure-form pure-form-aligned" id="form" name="form" 
method="post" action="{$form_action}">
+               <div id="tab-content">
+                       <xsl:value-of disable-output-escaping="yes" 
select="tabs"/>
+                       <div id="general">
+                               <fieldset>
+                                       <div class="pure-control-group">
+                                               <xsl:variable 
name="lang_substitute">
+                                                       <xsl:value-of 
select="php:function('lang', 'substitute')"/>
+                                               </xsl:variable>
+                                               <label>
+                                                       <xsl:value-of 
select="$lang_substitute"/>
+                                               </label>
+                                               <select 
name="substitute_user_id" id="substitute_user_id">
+                                                       <xsl:attribute 
name="title">
+                                                               <xsl:value-of 
select="$lang_substitute"/>
+                                                       </xsl:attribute>
+                                                       <option value="">
+                                                               <xsl:value-of 
select="php:function('lang', 'select')"/>
+                                                       </option>
+                                                       <xsl:apply-templates 
select="user_list/options"/>
+                                               </select>
+                                       </div>
+                               </fieldset>
+                       </div>
+               </div>
+               <xsl:variable name="lang_save">
+                       <xsl:value-of select="php:function('lang', 'save')"/>
+               </xsl:variable>
+               <input type="submit" class="pure-button pure-button-primary" 
name="save">
+                       <xsl:attribute name="value">
+                               <xsl:value-of select="$lang_save"/>
+                       </xsl:attribute>
+                       <xsl:attribute name="title">
+                               <xsl:value-of select="$lang_save"/>
+                       </xsl:attribute>
+               </input>
+       </form>
+</xsl:template>
+
+
+<!-- New template-->
+<xsl:template match="options">
+       <option value="{id}">
+               <xsl:if test="selected != 0">
+                       <xsl:attribute name="selected" value="selected"/>
+               </xsl:if>
+               <xsl:value-of disable-output-escaping="yes" select="name"/>
+       </option>
+</xsl:template>




reply via email to

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