fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [16050] more on integration


From: sigurdne
Subject: [Fmsystem-commits] [16050] more on integration
Date: Tue, 6 Dec 2016 14:53:16 +0000 (UTC)

Revision: 16050
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=16050
Author:   sigurdne
Date:     2016-12-06 14:53:15 +0000 (Tue, 06 Dec 2016)
Log Message:
-----------
more on integration

Modified Paths:
--------------
    trunk/property/inc/class.uitts.inc.php
    trunk/property/inc/custom/default/BkBygg_lag_Agresso_ordre_fra_melding.php

Modified: trunk/property/inc/class.uitts.inc.php
===================================================================
--- trunk/property/inc/class.uitts.inc.php      2016-12-06 14:52:15 UTC (rev 
16049)
+++ trunk/property/inc/class.uitts.inc.php      2016-12-06 14:53:15 UTC (rev 
16050)
@@ -3678,18 +3678,64 @@
                        {
                                $_budget_amount = 
$this->_get_budget_amount($id);
 
+
+                               try
+                               {
+                                       $check_purchase = 
$this->bo->check_purchase_right($ticket['ecodimb'], $_budget_amount, $id);
+
+                               }
+                               catch (Exception $ex)
+                               {
+                                       throw $ex;
+                               }
+
+
                                $purchase_grant_error = false;
-                               $check_purchase = 
$this->bo->check_purchase_right($ticket['ecodimb'], $_budget_amount, $id);
+
                                foreach ($check_purchase as $purchase_grant)
                                {
+//                                     if(!$purchase_grant['is_user'] && 
($purchase_grant['required'] && !$purchase_grant['approved']))
+//                                     {
+//                                             $purchase_grant_error = true;
+//                                             
phpgwapi_cache::message_set(lang('approval from %1 is required',
+//                                                             
$GLOBALS['phpgw']->accounts->get($purchase_grant['id'])->__toString()),
+//                                                             'error'
+//                                             );
+//                                     }
+
                                        if(!$purchase_grant['is_user'] && 
($purchase_grant['required'] && !$purchase_grant['approved']))
                                        {
                                                $purchase_grant_error = true;
-                                               
phpgwapi_cache::message_set(lang('approval from %1 is required',
-                                                               
$GLOBALS['phpgw']->accounts->get($purchase_grant['id'])->__toString()),
+                                               
phpgwapi_cache::message_set(lang('approval from %1 is required for order %2',
+                                                               
$GLOBALS['phpgw']->accounts->get($purchase_grant['id'])->__toString(), $id),
                                                                'error'
                                                );
                                        }
+                                       else if( $purchase_grant['is_user'] && 
( $purchase_grant['required'] && $purchase_grant['requested'] && 
!$purchase_grant['approved']))
+                                       {
+                                               $action_params = array(
+                                                       'appname' => 'property',
+                                                       'location' => '.ticket',
+                                                       'id' => $id,
+                                                       'responsible' => '',
+                                                       'responsible_type' => 
'user',
+                                                       'action' => 'approval',
+                                                       'remark' => '',
+                                                       'deadline' => ''
+                                               );
+
+                                               $_account_id = 
$purchase_grant['id'];//$this->account
+
+                                               $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('OA', $id, 
$GLOBALS['phpgw']->accounts->get($_account_id)->__toString() . 
"::{$_budget_amount}");
+                                               $purchase_grant_error = false;
+                                       }
+
                                }
                        }
 

Modified: 
trunk/property/inc/custom/default/BkBygg_lag_Agresso_ordre_fra_melding.php
===================================================================
--- trunk/property/inc/custom/default/BkBygg_lag_Agresso_ordre_fra_melding.php  
2016-12-06 14:52:15 UTC (rev 16049)
+++ trunk/property/inc/custom/default/BkBygg_lag_Agresso_ordre_fra_melding.php  
2016-12-06 14:53:15 UTC (rev 16050)
@@ -64,7 +64,7 @@
                        }
 
                        $purchase_grant_error = false;
-                       $check_purchase = 
CreateObject('property.botts')->check_purchase_right($data['ecodimb'], $price, 
$_ticket['order_id']);
+                       $check_purchase = 
CreateObject('property.botts')->check_purchase_right($_ticket['ecodimb'], 
$price, $_ticket['order_id']);
                        foreach ($check_purchase as $purchase_grant)
                        {
                                if(!$purchase_grant['is_user'] && 
($purchase_grant['required'] && !$purchase_grant['approved']))
@@ -75,6 +75,30 @@
                                                        'error'
                                        );
                                }
+                               else if( $purchase_grant['is_user'] && ( 
$purchase_grant['required'] && $purchase_grant['requested'] && 
!$purchase_grant['approved']))
+                               {
+                                       $action_params = array(
+                                               'appname' => 'property',
+                                               'location' => '.ticket',
+                                               'id' => $id,
+                                               'responsible' => '',
+                                               'responsible_type' => 'user',
+                                               'action' => 'approval',
+                                               'remark' => '',
+                                               'deadline' => ''
+                                       );
+
+                                       $_account_id = 
$purchase_grant['id'];//$this->account
+
+                                       $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('OA', $id, 
$GLOBALS['phpgw']->accounts->get($_account_id)->__toString() . "::{$price}");
+                                       $purchase_grant_error = false;
+                               }
                        }
                        if (!$this->debug && $purchase_grant_error)
                        {




reply via email to

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