fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [16003] more on integration


From: sigurdne
Subject: [Fmsystem-commits] [16003] more on integration
Date: Thu, 17 Nov 2016 11:27:54 +0000 (UTC)

Revision: 16003
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=16003
Author:   sigurdne
Date:     2016-11-17 11:27:54 +0000 (Thu, 17 Nov 2016)
Log Message:
-----------
more on integration

Modified Paths:
--------------
    trunk/property/inc/class.botts.inc.php
    trunk/property/js/portico/workorder.edit.js
    trunk/property/templates/base/workorder.xsl

Modified: trunk/property/inc/class.botts.inc.php
===================================================================
--- trunk/property/inc/class.botts.inc.php      2016-11-17 02:00:44 UTC (rev 
16002)
+++ trunk/property/inc/class.botts.inc.php      2016-11-17 11:27:54 UTC (rev 
16003)
@@ -1786,11 +1786,20 @@
                                return array();
                        }
 
-///////////
+                       $config         = CreateObject('admin.soconfig', 
$GLOBALS['phpgw']->locations->get_id('property', '.ticket'));
+                       $check_external_register= 
!!$config->config_data['external_register']['check_external_register'];
                        $supervisors = array();
                        $invoice = CreateObject('property.soinvoice');
                        if (isset($this->config->config_data['invoice_acl']) && 
$this->config->config_data['invoice_acl'] == 'dimb')
                        {
+                               $default_found = false;
+                               $supervisor_id = 
$invoice->get_default_dimb_role_user(3, $ecodimb);
+                               if($supervisor_id)
+                               {
+                                       $supervisors[$supervisor_id] =  
array('id' => $supervisor_id, 'required' => false, 'default' => true);
+                                       $default_found = true;
+                               }
+
                                $sodimb_role_users = 
execMethod('property.sodimb_role_user.read', array
                                        (
                                        'dimb_id' => $ecodimb,
@@ -1803,45 +1812,13 @@
                                {
                                        foreach 
($sodimb_role_users[$ecodimb][2] as $supervisor_id => $entry)
                                        {
-                                               $supervisors[] = $supervisor_id;
+                                               $supervisors[$supervisor_id] = 
array('id' => $supervisor_id, 'required' => false, 'default' =>  
!$default_found ? !!$entry['default_user'] : false);
                                        }
                                }
 
-                               $supervisors[] =  
$invoice->get_default_dimb_role_user(3, $ecodimb);
                        }
-                       else
+                       else if($check_external_register && $ecodimb)
                        {
-                               $supervisor_id = 0;
-
-                               if 
(isset($GLOBALS['phpgw_info']['user']['preferences']['property']['approval_from'])
 && $GLOBALS['phpgw_info']['user']['preferences']['property']['approval_from'])
-                               {
-                                       $supervisor_id = 
$GLOBALS['phpgw_info']['user']['preferences']['property']['approval_from'];
-                               }
-
-
-                               if ($supervisor_id)
-                               {
-                                       $supervisors[] = $supervisor_id;
-
-                                       $prefs = 
$this->bocommon->create_preferences('property', $supervisor_id);
-
-                                       if (!empty($prefs['approval_from']))
-                                       {
-                                               $supervisors[] = 
$prefs['approval_from'];
-                                       }
-                                       unset($prefs);
-                               }
-                       }
-                       $supervisors = array_reverse($supervisors);
-
-                               
-////////////////
-
-                       $config         = CreateObject('admin.soconfig', 
$GLOBALS['phpgw']->locations->get_id('property', '.ticket'));
-                       $check_external_register= 
!!$config->config_data['external_register']['check_external_register'];
-
-                       if($check_external_register && $ecodimb)
-                       {
                                $url            = 
$config->config_data['external_register']['url'];
                                $username       = 
$config->config_data['external_register']['username'];
                                $password       = 
$config->config_data['external_register']['password'];
@@ -1857,6 +1834,7 @@
 
                                /**
                                 * some magic...to decide $supervisor_lid
+                                * Agresso/Bergen spesific
                                 */
                                if(isset($fullmakter[0]))
                                {
@@ -1894,17 +1872,40 @@
                                        [aktiv] => (bool) true
                                */
 
-                               $supervisors[] = 
$GLOBALS['phpgw']->accounts->name2id($supervisor_lid);
+                               $supervisor_id = 
$GLOBALS['phpgw']->accounts->name2id($supervisor_lid);
+                               $supervisors[$supervisor_id] = array('id' => 
$supervisor_id, 'required' => true);
                        }
                        else
                        {
-                               
if(!empty($GLOBALS['phpgw_info']['user']['preferences']['property']['approval_from'])
-                                       && 
!in_array($GLOBALS['phpgw_info']['user']['preferences']['property']['approval_from'],$supervisors))
+                               $supervisor_id = 0;
+
+                               if 
(!empty($GLOBALS['phpgw_info']['user']['preferences']['property']['approval_from']))
                                {
-                                       $supervisors[] =  
$GLOBALS['phpgw_info']['user']['preferences']['property']['approval_from'];
+                                       $supervisor_id = 
$GLOBALS['phpgw_info']['user']['preferences']['property']['approval_from'];
                                }
+
+                               if ($supervisor_id)
+                               {
+                                       $supervisors[$supervisor_id] = 
array('id' => $supervisor_id, 'required' => false);
+
+                                       $prefs = 
$this->bocommon->create_preferences('property', $supervisor_id);
+
+                                       if (!empty($prefs['approval_from']))
+                                       {
+                                               $supervisor_id = 
$prefs['approval_from'];
+                                               $supervisors[$supervisor_id] = 
array('id' => $supervisor_id, 'required' => false);
+                                       }
+                                       unset($prefs);
+                               }
                        }
 
+                       if(!$check_external_register && 
!empty($GLOBALS['phpgw_info']['user']['preferences']['property']['approval_from'])
+                               && 
!in_array($GLOBALS['phpgw_info']['user']['preferences']['property']['approval_from'],$supervisors))
+                       {
+                               $supervisor_id =  
$GLOBALS['phpgw_info']['user']['preferences']['property']['approval_from'];
+                               $supervisors[$supervisor_id] = array('id' => 
$supervisor_id, 'required' => false, 'default' => true);
+                       }
+
                        return $this->get_supervisor_email($supervisors, 
$order_id);
                }
 
@@ -1973,7 +1974,7 @@
                        $supervisor_email = array();
                        if ($supervisors && $need_approval)
                        {
-                               foreach ($supervisors as $supervisor_id)
+                               foreach ($supervisors as $supervisor_id => 
$info)
                                {
                                        $dateformat = 
$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'];
 
@@ -2006,7 +2007,8 @@
                                                $supervisor_email[] = array(
                                                        'id' => $supervisor_id,
                                                        'address' => 
$prefs['email'],
-                                                       'required'      => true,
+                                                       'required'      => 
$info['required'],
+                                                       'default'       => 
!!$info['default'],
                                                        'requested'     => 
!!$requests[0]['action_requested'],
                                                        'requested_time'=> 
$GLOBALS['phpgw']->common->show_date($requests[0]['action_requested'], 
$dateformat),
                                                        'approved'      => 
!!$approvals[0]['action_performed'],
@@ -2019,7 +2021,8 @@
                                                $supervisor_email[] = array(
                                                        'id' => $supervisor_id,
                                                        'address' => 
$GLOBALS['phpgw']->accounts->id2name($supervisor_id) . '@bergen.kommune.no',
-                                                       'required'      => true
+                                                       'required'      => 
$info['required'],
+                                                       'default'       => 
!!$info['default']
                                                );
                                        }
                                

Modified: trunk/property/js/portico/workorder.edit.js
===================================================================
--- trunk/property/js/portico/workorder.edit.js 2016-11-17 02:00:44 UTC (rev 
16002)
+++ trunk/property/js/portico/workorder.edit.js 2016-11-17 11:27:54 UTC (rev 
16003)
@@ -1,5 +1,6 @@
 var amount = 0;
 var vendor_id;
+var project_ecodimb;
 
 function calculate_order()
 {
@@ -402,7 +403,7 @@
                return;
        }
 
-       var width =  $("#submitbox").width();
+       var width = $("#submitbox").width();
 
        $("#submitbox").css({
                position: 'absolute',
@@ -463,6 +464,7 @@
 $(window).on('load', function ()
 {
        ecodimb = $('#ecodimb').val();
+       ecodimb = ecodimb || project_ecodimb
        if (ecodimb)
        {
                populateTableChkApproval();
@@ -487,6 +489,7 @@
 function populateTableChkApproval(ecodimb)
 {
        ecodimb = ecodimb || $('#ecodimb').val();
+       ecodimb = ecodimb || project_ecodimb
 
        if (!ecodimb)
        {
@@ -530,10 +533,17 @@
                                        {
                                                if (obj[i].approved !== true)
                                                {
-                                                       if (obj[i].required === 
true)
+                                                       if (obj[i].required === 
true || obj[i].default === true)
                                                        {
-                                                               required = 
'checked="checked" disabled="disabled"';
                                                                left_cell = 
"<input type=\"hidden\" name=\"values[approval][" + obj[i].id + "]\" value=\"" 
+ obj[i].address + "\"></input>";
+                                                               if 
(obj[i].required === true)
+                                                               {
+                                                                       
required = 'checked="checked" disabled="disabled"';
+                                                               }
+                                                               else
+                                                               {
+                                               //                      
required = 'checked="checked"';
+                                                               }
                                                        }
                                                        else
                                                        {
@@ -548,7 +558,14 @@
                                        }
                                        htmlString += left_cell;
                                        htmlString += "</td><td 
valign=\"top\">";
-                                       htmlString += obj[i].address;
+                                       if (obj[i].required === true || 
obj[i].default === true)
+                                       {
+                                               htmlString += '<b>[' + 
obj[i].address + ']</b>';
+                                       }
+                                       else
+                                       {
+                                               htmlString += obj[i].address;
+                                       }
                                        htmlString += "</td>";
                                        htmlString += "<td>";
 

Modified: trunk/property/templates/base/workorder.xsl
===================================================================
--- trunk/property/templates/base/workorder.xsl 2016-11-17 02:00:44 UTC (rev 
16002)
+++ trunk/property/templates/base/workorder.xsl 2016-11-17 11:27:54 UTC (rev 
16003)
@@ -1237,6 +1237,7 @@
                                var lang = <xsl:value-of 
select="php:function('js_lang', 'please enter either a budget or contrakt 
sum')"/>;
                                var check_for_budget = <xsl:value-of 
select="check_for_budget"/>;
                                var amount = <xsl:value-of 
select="check_value_budget"/>;
+                               var project_ecodimb = '<xsl:value-of 
select="project_ecodimb"/>';
                                var base_java_url = <xsl:value-of 
select="base_java_url"/>;
                                var location_item_id = '<xsl:value-of 
select="location_item_id"/>';
                                var order_id = '<xsl:value-of 
select="value_workorder_id"/>';




reply via email to

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