fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [16718] more on integration


From: sigurdne
Subject: [Fmsystem-commits] [16718] more on integration
Date: Wed, 10 May 2017 10:15:29 -0400 (EDT)

Revision: 16718
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=16718
Author:   sigurdne
Date:     2017-05-10 10:15:29 -0400 (Wed, 10 May 2017)
Log Message:
-----------
more on integration

Modified Paths:
--------------
    trunk/property/inc/class.sotts.inc.php
    trunk/property/inc/class.uitts.inc.php
    trunk/property/inc/class.uiwo_hour.inc.php
    trunk/property/inc/hook_config.inc.php
    trunk/property/templates/base/config.tpl

Modified: trunk/property/inc/class.sotts.inc.php
===================================================================
--- trunk/property/inc/class.sotts.inc.php      2017-05-10 04:44:19 UTC (rev 
16717)
+++ trunk/property/inc/class.sotts.inc.php      2017-05-10 14:15:29 UTC (rev 
16718)
@@ -1804,12 +1804,15 @@
 
                        if ($this->db->f('approved'))
                        {
+                               $sosubstitute = 
CreateObject('property.sosubstitute');
+                               $users_for_substitute = 
$sosubstitute->get_users_for_substitute($this->account);
+                               $take_responsibility_for = 
array($this->account);
+
                                $action_params = array
                                        (
                                        'appname' => 'property',
                                        'location' => '.ticket',
                                        'id' => $id,
-                                       'responsible' => $this->account,
                                        'responsible_type' => 'user',
                                        'action' => 'approval',
                                        'remark' => '',
@@ -1816,8 +1819,24 @@
                                        'deadline' => ''
                                );
 
-                               
execMethod('property.sopending_action.close_pending_action', $action_params);
+                               $approvals = 
execMethod('property.sopending_action.get_pending_action', $action_params);
+
+                               foreach ($approvals as $approval)
+                               {
+                                       
if(in_array($approval['responsible'],$users_for_substitute))
+                                       {
+                                               $take_responsibility_for[] = 
$approval['responsible'];
+                                       }
+                               }
+
+                               foreach ($take_responsibility_for as 
$__account_id)
+                               {
+                                       $action_params['responsible'] = 
$__account_id;
+                                       
execMethod('property.sopending_action.close_pending_action', $action_params);
+                               }
+
                                unset($action_params);
+
                        }
                        /*
                         * Sigurd: Consider remove

Modified: trunk/property/inc/class.uitts.inc.php
===================================================================
--- trunk/property/inc/class.uitts.inc.php      2017-05-10 04:44:19 UTC (rev 
16717)
+++ trunk/property/inc/class.uitts.inc.php      2017-05-10 14:15:29 UTC (rev 
16718)
@@ -1918,6 +1918,12 @@
                                {
                                        $values['assignedto'] = $this->account;
                                }
+
+                               if (!empty($values['approval']) && 
!empty($this->bo->config->config_data['ticket_approval_status']))
+                               {
+                                       $values['status'] = 
$this->bo->config->config_data['ticket_approval_status'];
+                               }
+
                                /*
                                  if(isset($values_attribute) && 
is_array($values_attribute))
                                  {
@@ -2227,6 +2233,7 @@
                        }
 
                        $_budget_amount = $this->_get_budget_amount($id);
+                       $sosubstitute = CreateObject('property.sosubstitute');
 
                        if (isset($values['approval']) && $values['approval'] 
&& $this->bo->config->config_data['workorder_approval'])
                        {
@@ -2258,8 +2265,16 @@
                                        'deadline' => ''
                                );
                                $bcc = '';//$coordinator_email;
+
                                foreach ($values['approval'] as $_account_id => 
$_address)
                                {
+                                       $substitute = 
$sosubstitute->get_substitute($_account_id);
+
+                                       if($substitute)
+                                       {
+                                               $_account_id = $substitute;
+                                       }
+
                                        $prefs = 
$this->bocommon->create_preferences('property', $_account_id);
                                        if (!empty($prefs['email']))
                                        {
@@ -2287,7 +2302,7 @@
                                                
phpgwapi_cache::message_set($exc->getMessage(),'error');
                                        }
                                }
-                               
+                       
                        }
        
                        if (!empty($values['do_approve']) && 
is_array($values['do_approve']))
@@ -2303,19 +2318,46 @@
                                        'deadline' => ''
                                );
 
+//                             foreach ($values['do_approve'] as $_account_id 
=> $_dummy)
+//                             {
+//                                     $action_params['responsible'] = 
$_account_id;
+//                                     
if(!execMethod('property.sopending_action.get_pending_action', $action_params))
+//                                     {
+//                                             
execMethod('property.sopending_action.set_pending_action', $action_params);
+//                                     }
+//                                     
execMethod('property.sopending_action.close_pending_action', $action_params);
+//                                     $historylog->add('AA', $id, 
$GLOBALS['phpgw']->accounts->get($_account_id)->__toString() . 
"::{$_budget_amount}");
+//                             }
+
+////
                                foreach ($values['do_approve'] as $_account_id 
=> $_dummy)
                                {
-                                       $action_params['responsible'] = 
$_account_id;
-                                       
if(!execMethod('property.sopending_action.get_pending_action', $action_params))
+                                       $users_for_substitute = 
$sosubstitute->get_users_for_substitute($_account_id);
+
+                                       $approvals = 
execMethod('property.sopending_action.get_pending_action', $action_params);
+
+                                       $take_responsibility_for = 
array($_account_id);
+                                       foreach ($approvals as $approval)
                                        {
-                                               
execMethod('property.sopending_action.set_pending_action', $action_params);
+                                               
if(in_array($approval['responsible'],$users_for_substitute))
+                                               {
+                                                       
$take_responsibility_for[] = $approval['responsible'];
+                                               }
                                        }
-                                       
execMethod('property.sopending_action.close_pending_action', $action_params);
-                                       $historylog->add('AA', $id, 
$GLOBALS['phpgw']->accounts->get($_account_id)->__toString() . 
"::{$_budget_amount}");
+                                       foreach ($take_responsibility_for as 
$__account_id)
+                                       {
+                                               $action_params['responsible'] = 
$__account_id;
+                                               
if(!execMethod('property.sopending_action.get_pending_action', $action_params))
+                                               {
+                                                       
execMethod('property.sopending_action.set_pending_action', $action_params);
+                                               }
+                                               
execMethod('property.sopending_action.close_pending_action', $action_params);
+                                               $historylog->add('AA', $id, 
$GLOBALS['phpgw']->accounts->get($__account_id)->__toString() . 
"::{$_budget_amount}");
+                                       }
+                                       unset($action_params['responsible']);
                                }
                        }
 
-
                        // end approval
                        // -------- end order section
 

Modified: trunk/property/inc/class.uiwo_hour.inc.php
===================================================================
--- trunk/property/inc/class.uiwo_hour.inc.php  2017-05-10 04:44:19 UTC (rev 
16717)
+++ trunk/property/inc/class.uiwo_hour.inc.php  2017-05-10 14:15:29 UTC (rev 
16718)
@@ -3411,6 +3411,7 @@
                        catch (Exception $e)
                        {
                                phpgwapi_cache::message_set($e->getMessage(), 
'error');
+                               throw $e;
                        }
 
                        $criteria = array

Modified: trunk/property/inc/hook_config.inc.php
===================================================================
--- trunk/property/inc/hook_config.inc.php      2017-05-10 04:44:19 UTC (rev 
16717)
+++ trunk/property/inc/hook_config.inc.php      2017-05-10 14:15:29 UTC (rev 
16718)
@@ -249,6 +249,34 @@
        }
 
        /**
+        * Get HTML listbox with ticket order status that are to be set when 
asking for approval
+        *
+        * @param $config
+        * @return string HTML checkboxes to be placed in a table
+        */
+       function ticket_approval_status( $config )
+       {
+               $status_assigned = isset($config['ticket_approval_status']) ? 
$config['ticket_approval_status'] : '';
+               $status_entries = execMethod('property.botts.get_status_list', 
$status_assigned);
+
+               $out = '<option value="">' . lang('none selected') . 
'</option>' . "\n";
+               foreach ($status_entries as $status)
+               {
+                       $selected = '';
+                       if (1 == $status['selected'])
+                       {
+                               $selected = ' selected = "selected"';
+                       }
+
+                       $out .= <<<HTML
+                       <option 
value='{$status['id']}'{$selected}>{$status['name']}</option>
+HTML;
+               }
+
+               return $out;
+       }
+
+       /**
         * Get HTML listbox with workorder status that are to be set when 
asking for approval
         *
         * @param $config

Modified: trunk/property/templates/base/config.tpl
===================================================================
--- trunk/property/templates/base/config.tpl    2017-05-10 04:44:19 UTC (rev 
16717)
+++ trunk/property/templates/base/config.tpl    2017-05-10 14:15:29 UTC (rev 
16718)
@@ -123,6 +123,14 @@
                                </td>
                        </tr>
                        <tr>
+                               <td>{lang_ticket_status_on_approval}:</td>
+                               <td>
+                                       <select 
name="newsettings[ticket_approval_status]">
+                                               {hook_ticket_approval_status}
+                                       </select>
+                               </td>
+                       </tr>
+                       <tr>
                                <td>{lang_approval_amount_limit}:</td>
                                <td>
                                        <input 
name="newsettings[approval_amount_limit]" value="{value_approval_amount_limit}">




reply via email to

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