fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [16023] more on integration


From: sigurdne
Subject: [Fmsystem-commits] [16023] more on integration
Date: Fri, 25 Nov 2016 10:21:03 +0000 (UTC)

Revision: 16023
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=16023
Author:   sigurdne
Date:     2016-11-25 10:21:03 +0000 (Fri, 25 Nov 2016)
Log Message:
-----------
more on integration

Modified Paths:
--------------
    trunk/property/inc/class.boproject.inc.php
    trunk/property/inc/class.boworkorder.inc.php
    trunk/property/inc/class.uiproject.inc.php
    trunk/property/inc/class.uiwo_hour.inc.php
    trunk/property/inc/class.uiworkorder.inc.php
    trunk/property/setup/phpgw_no.lang
    trunk/property/templates/base/project.xsl

Modified: trunk/property/inc/class.boproject.inc.php
===================================================================
--- trunk/property/inc/class.boproject.inc.php  2016-11-24 14:29:27 UTC (rev 
16022)
+++ trunk/property/inc/class.boproject.inc.php  2016-11-25 10:21:03 UTC (rev 
16023)
@@ -976,7 +976,7 @@
                                                {
                                                        if ($e)
                                                        {
-                                                               
phpgwapi_cache::message_set($e->getMessage(), 'error');
+//                                                             
phpgwapi_cache::message_set($e->getMessage(), 'error');
                                                        }
                                                }
                                        }

Modified: trunk/property/inc/class.boworkorder.inc.php
===================================================================
--- trunk/property/inc/class.boworkorder.inc.php        2016-11-24 14:29:27 UTC 
(rev 16022)
+++ trunk/property/inc/class.boworkorder.inc.php        2016-11-25 10:21:03 UTC 
(rev 16023)
@@ -1044,19 +1044,19 @@
 
                function get_budget_amount($id)
                {
-                       static $_budget_amount = 0;
-                       if(!$_budget_amount)
+                       static $_budget_amount = array();
+                       if(empty($_budget_amount[$id]))
                        {
                                $budgets = $this->get_budget($id);
                                foreach ($budgets as $budget)
                                {
                                        if ($budget['active'] == 1)
                                        {
-                                               $_budget_amount += 
$budget['budget'];
+                                               $_budget_amount[$id] += 
$budget['budget'];
                                        }
                                }
                        }
-                       return $_budget_amount;
+                       return $_budget_amount[$id];
                }
 
        }
\ No newline at end of file

Modified: trunk/property/inc/class.uiproject.inc.php
===================================================================
--- trunk/property/inc/class.uiproject.inc.php  2016-11-24 14:29:27 UTC (rev 
16022)
+++ trunk/property/inc/class.uiproject.inc.php  2016-11-25 10:21:03 UTC (rev 
16023)
@@ -1165,7 +1165,9 @@
                        if ($id)
                        {
                                self::message_set($this->receipt);
-                               self::redirect(array('menuaction' => 
'property.uiproject.edit', 'id' => $id));
+                               $active_tab = phpgw::get_var('tab');
+
+                               self::redirect(array('menuaction' => 
'property.uiproject.edit', 'id' => $id, 'tab' => $active_tab));
                        }
 
                        $this->edit($values, 'edit');

Modified: trunk/property/inc/class.uiwo_hour.inc.php
===================================================================
--- trunk/property/inc/class.uiwo_hour.inc.php  2016-11-24 14:29:27 UTC (rev 
16022)
+++ trunk/property/inc/class.uiwo_hour.inc.php  2016-11-25 10:21:03 UTC (rev 
16023)
@@ -1500,11 +1500,30 @@
                                                $body = $header . $html . 
$footer;
                                        }
 
+                                       $_status = 
isset($this->config->config_data['workorder_ordered_status']) && 
$this->config->config_data['workorder_ordered_status'] ? 
$this->config->config_data['workorder_ordered_status'] : 0;
+
+                                       if (!$_status)
+                                       {
+                                               throw new Exception('status on 
ordered not given in config');
+                                       }
+
                                        if (!is_object($GLOBALS['phpgw']->send))
                                        {
                                                $GLOBALS['phpgw']->send = 
CreateObject('phpgwapi.send');
                                        }
-                                       $rcpt = 
$GLOBALS['phpgw']->send->msg('email', $_to, $subject, $body, '', $cc, $bcc, 
$from_email, $from_name, 'html', '', $attachments, $email_receipt);
+
+                                       try
+                                       {
+                                               $rcpt = 
$GLOBALS['phpgw']->send->msg('email', $_to, $subject, $body, '', $cc, $bcc, 
$from_email, $from_name, 'html', '', $attachments, $email_receipt);
+                                       }
+                                       catch (Exception $e)
+                                       {
+                                               if ($e)
+                                               {
+                                                       throw $e;
+                                               }
+                                       }
+
                                }
                                else
                                {
@@ -1534,6 +1553,21 @@
                                                        $workorder_id), 
$this->config->config_data['sms_client_order_notice']));
                                                $historylog->add('MS', 
$workorder_id, $to_sms_phone);
                                        }
+
+                                       try
+                                       {
+                                               
execMethod('property.soworkorder.update_status', array('order_id' => 
$workorder_id,
+                                                       'status' => $_status));
+                                       }
+                                       catch (Exception $e)
+                                       {
+                                               if ($e)
+                                               {
+                                                       throw $e;
+                                               }
+                                       }
+
+
                                        //Sigurd: Consider remove
                                        /*
                                          if( 
$this->boworkorder->order_sent_adress )
@@ -1825,8 +1859,7 @@
                {
                        if (!$this->acl_read)
                        {
-                               $GLOBALS['phpgw']->redirect_link('/index.php', 
array('menuaction' => 'property.uilocation.stop',
-                                       'perm' => 1, 'acl_location' => 
$this->acl_location));
+                               phpgw::no_access();
                        }
                        if (!$workorder_id)
                        {
@@ -1866,9 +1899,10 @@
 
                                if (!$_ok)
                                {
-                                       phpgwapi_cache::message_set(lang('order 
is not approved'), 'error');
-                                       
$GLOBALS['phpgw']->redirect_link('/index.php', array('menuaction' => 
'property.uiwo_hour.view',
-                                               'workorder_id' => 
$workorder_id, 'from' => phpgw::get_var('from')));
+                                       throw new Exception(lang('order %1 is 
not approved'), $workorder_id);
+//                                     phpgwapi_cache::message_set(lang('order 
is not approved'), 'error');
+//                                     
$GLOBALS['phpgw']->redirect_link('/index.php', array('menuaction' => 
'property.uiwo_hour.view',
+//                                             'workorder_id' => 
$workorder_id, 'from' => phpgw::get_var('from')));
                                }
                                unset($_ok);
                        }
@@ -1876,8 +1910,9 @@
                        {
                                
if(!$this->_validate_purchase_grant($workorder_id, $project['ecodimb'] ? 
$project['ecodimb'] : $workorder['ecodimb']))
                                {
-                                       
$GLOBALS['phpgw']->redirect_link('/index.php', array('menuaction' => 
'property.uiwo_hour.view',
-                                               'workorder_id' => 
$workorder_id, 'from' => phpgw::get_var('from')));
+                                       throw new Exception(lang('order %1 is 
not approved'), $workorder_id);
+//                                     
$GLOBALS['phpgw']->redirect_link('/index.php', array('menuaction' => 
'property.uiwo_hour.view',
+//                                             'workorder_id' => 
$workorder_id, 'from' => phpgw::get_var('from')));
                                }
                        }
 
@@ -3415,6 +3450,7 @@
                private function _validate_purchase_grant( $id, $ecodimb )
                {
                        $_budget_amount = 
$this->boworkorder->get_budget_amount($id);
+                       $historylog = CreateObject('property.historylog', 
'workorder');
 
                        $purchase_grant_ok = false;
                        $check_purchase = 
createObject('property.botts')->check_purchase_right($ecodimb, $_budget_amount, 
$id);
@@ -3427,11 +3463,35 @@
                                if(!$purchase_grant['is_user'] && 
($purchase_grant['required'] && !$purchase_grant['approved']))
                                {
                                        $purchase_grant_ok = false;
-                                       
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' => 
'.project.workorder',
+                                               '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_ok = true;
+                               }
                        }
                        return $purchase_grant_ok;
                }

Modified: trunk/property/inc/class.uiworkorder.inc.php
===================================================================
--- trunk/property/inc/class.uiworkorder.inc.php        2016-11-24 14:29:27 UTC 
(rev 16022)
+++ trunk/property/inc/class.uiworkorder.inc.php        2016-11-25 10:21:03 UTC 
(rev 16023)
@@ -1195,9 +1195,11 @@
                                if ($id)
                                {
                                        self::message_set($this->receipt);
+                                       $active_tab = phpgw::get_var('tab');
                                        self::redirect(array(
                                                'menuaction' => 
'property.uiworkorder.edit',
-                                               'id' => $id));
+                                               'id' => $id,
+                                               'tab' => $active_tab));
                                }
                                $this->edit($values);
 

Modified: trunk/property/setup/phpgw_no.lang
===================================================================
--- trunk/property/setup/phpgw_no.lang  2016-11-24 14:29:27 UTC (rev 16022)
+++ trunk/property/setup/phpgw_no.lang  2016-11-25 10:21:03 UTC (rev 16023)
@@ -1209,7 +1209,7 @@
 order  property        no      Bestilling
 order approval revoked property        no      Bestillingsgodkjenning opphevet
 order approved property        no      Bestilling godkjent
-order is not approved  property        no      Bestilling er ikke godkjent
+order order %1 is not approved property        no      Bestilling %1 er ikke 
godkjent
 order_dim1     property        no      Aktivitet
 order id       property        no      BestillingsNr
 order_id       property        no      BestillingsNr
@@ -2068,5 +2068,5 @@
 update ticket  property        no      Oppdater melding
 make relation  property        no      Opprett kopling
 request for approval   property        no      Anmodning om godkjenning
-approval from %1 is required   property        no      Godkjenning fra %1 er 
påkrevd
+approval from %1 is required for order %2      property        no      
Godkjenning fra %1 er påkrevd for ordre %2
 missing recipient for order %1 property        no      Mangler mottaker for 
ordre %1
\ No newline at end of file

Modified: trunk/property/templates/base/project.xsl
===================================================================
--- trunk/property/templates/base/project.xsl   2016-11-24 14:29:27 UTC (rev 
16022)
+++ trunk/property/templates/base/project.xsl   2016-11-25 10:21:03 UTC (rev 
16023)
@@ -267,7 +267,7 @@
                                                        </div>
                                                </xsl:when>
                                        </xsl:choose>
-                                       <xsl:choose>
+                                       <!--xsl:choose>
                                                <xsl:when 
test="need_approval='1' and mode='edit'">
                                                        <div 
class="pure-control-group">
                                                                <label 
for="name">
@@ -294,7 +294,7 @@
                                                                </div>
                                                        </div>
                                                </xsl:when>
-                                       </xsl:choose>
+                                       </xsl:choose-->
                                        <div class="pure-control-group">
                                                <label for="name">
                                                        <xsl:value-of 
select="lang_remark"/>




reply via email to

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