fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [7540] property: tweak request


From: Sigurd Nes
Subject: [Fmsystem-commits] [7540] property: tweak request
Date: Tue, 30 Aug 2011 13:32:21 +0000

Revision: 7540
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=7540
Author:   sigurdne
Date:     2011-08-30 13:32:20 +0000 (Tue, 30 Aug 2011)
Log Message:
-----------
property: tweak request

Modified Paths:
--------------
    trunk/property/inc/class.borequest.inc.php
    trunk/property/inc/class.sorequest.inc.php
    trunk/property/inc/class.uirequest.inc.php
    trunk/property/setup/phpgw_no.lang
    trunk/property/templates/base/request.xsl

Modified: trunk/property/inc/class.borequest.inc.php
===================================================================
--- trunk/property/inc/class.borequest.inc.php  2011-08-30 12:04:36 UTC (rev 
7539)
+++ trunk/property/inc/class.borequest.inc.php  2011-08-30 13:32:20 UTC (rev 
7540)
@@ -304,7 +304,7 @@
                                        'degree'                                
=> array('options' => $this->select_degree_list($conditions[$i]['degree'])),
                                        'probability'                   => 
array('options' => 
$this->select_probability_list($conditions[$i]['probability'])),
                                        'consequence'                   => 
array('options' => 
$this->select_consequence_list($conditions[$i]['consequence'])),
-                                       'condition_type'                => 
$condition_type_list[$i]['id'],
+                                       'condition_type'                => 
(int)$condition_type_list[$i]['id'],
                                        'condition_type_name'   => 
$condition_type_list[$i]['name'],
                                        'condition_type_descr'  => 
$condition_type_list[$i]['descr'],
                                        'failure'                               
=> (int)$conditions[$i]['reference'] - (int)$conditions[$i]['degree'] < 0 ? 'X' 
: '',
@@ -536,25 +536,25 @@
 
                                switch ($value['status'])
                                {
-                               case 'R': $type = lang('Re-opened'); break;
-                               case 'X': $type = lang('Closed');    break;
-                               case 'O': $type = lang('Opened');    break;
-                               case 'A': $type = lang('Re-assigned'); break;
-                               case 'P': $type = lang('Priority changed'); 
break;
-                               case 'CO': $type = lang('Initial Coordinator'); 
break;
-                               case 'C': $type = lang('Coordinator changed'); 
break;
-                               case 'TO': $type = lang('Initial Category'); 
break;
-                               case 'T': $type = lang('Category changed'); 
break;
-                               case 'SO': $type = lang('Initial Status'); 
break;
-                               case 'S': $type = lang('Status changed'); break;
-                               default: break;
+                                       case 'B': $type = lang('Budget 
changed'); break;
+                                       case 'R': $type = lang('Re-opened'); 
break;
+                                       case 'X': $type = lang('Closed');    
break;
+                                       case 'O': $type = lang('Opened');    
break;
+                                       case 'A': $type = lang('Re-assigned'); 
break;
+                                       case 'P': $type = lang('Priority 
changed'); break;
+                                       case 'CO': $type = lang('Initial 
Coordinator'); break;
+                                       case 'C': $type = lang('Coordinator 
changed'); break;
+                                       case 'TO': $type = lang('Initial 
Category'); break;
+                                       case 'T': $type = lang('Category 
changed'); break;
+                                       case 'SO': $type = lang('Initial 
Status'); break;
+                                       case 'S': $type = lang('Status 
changed'); break;
+                                       default: break;
                                }
 
                                
if($value['new_value']=='O'){$value['new_value']=lang('Opened');}
-                                       
if($value['new_value']=='X'){$value['new_value']=lang('Closed');}
+                               
if($value['new_value']=='X'){$value['new_value']=lang('Closed');}
 
-
-                                               
$record_history[$i]['value_action']     = $type?$type:'';
+                               $record_history[$i]['value_action']     = 
$type?$type:'';
                                unset($type);
 
                                if ($value['status'] == 'A')
@@ -568,18 +568,29 @@
                                                
$record_history[$i]['value_new_value']  = 
$GLOBALS['phpgw']->accounts->id2name($value['new_value']);
                                        }
                                }
-                               else if ($value['status'] == 'C' || 
$value['status'] == 'CO')
+                               else if ($value['status'] == 'C')
                                {
                                        $record_history[$i]['value_new_value']  
= $GLOBALS['phpgw']->accounts->id2name($value['new_value']);
+                                       $record_history[$i]['value_old_value']  
= $GLOBALS['phpgw']->accounts->id2name($value['old_value']);
                                }
+                               else if ($value['status'] == 'CO')
+                               {
+                                       $record_history[$i]['value_new_value']  
= $GLOBALS['phpgw']->accounts->id2name($value['new_value']);
+                               }
                                else if ($value['status'] == 'T' || 
$value['status'] == 'TO')
                                {
                                        $category                               
                                = 
$this->cats->return_single($value['new_value']);
                                        $record_history[$i]['value_new_value']  
= $category[0]['name'];
                                }
+                               else if ($value['status'] == 'B' && 
$value['new_value'])
+                               {
+                                       $record_history[$i]['value_new_value']  
=number_format($value['new_value'], 0, ',', ' ');
+                                       $record_history[$i]['value_old_value']  
=number_format($value['old_value'], 0, ',', ' ');
+                               }
                                else if ($value['status'] != 'O' && 
$value['new_value'])
                                {
                                        $record_history[$i]['value_new_value']  
= $value['new_value'];
+                                       $record_history[$i]['value_old_value']  
= $value['old_value'];
                                }
                                else
                                {

Modified: trunk/property/inc/class.sorequest.inc.php
===================================================================
--- trunk/property/inc/class.sorequest.inc.php  2011-08-30 12:04:36 UTC (rev 
7539)
+++ trunk/property/inc/class.sorequest.inc.php  2011-08-30 13:32:20 UTC (rev 
7540)
@@ -665,8 +665,8 @@
                        $values = 
$this->bocommon->validate_db_insert(array_values($value_set));
 
                        $this->db->query("INSERT INTO fm_request ({$cols}) 
VALUES ({$values})",__LINE__,__FILE__);
-_debug_array($request);die();
 
+
                        if(isset($request['condition']) && 
is_array($request['condition']))
                        {
                                foreach( $request['condition'] as 
$condition_type => $value_type )
@@ -829,9 +829,10 @@
 
                        $this->db->transaction_begin();
 
-                       $this->db->query("SELECT status,category,coordinator 
FROM fm_request where id='" .$request['id']."'",__LINE__,__FILE__);
+                       $this->db->query("SELECT 
budget,status,category,coordinator FROM fm_request where id='" 
.$request['id']."'",__LINE__,__FILE__);
                        $this->db->next_record();
 
+                       $old_budget                     = 
$this->db->f('budget');
                        $old_status = $this->db->f('status');
                        $old_category = $this->db->f('category');
                        $old_coordinator = $this->db->f('coordinator');
@@ -937,17 +938,22 @@
                        {
                                if ($old_status != $request['status'])
                                {
-                                       
$this->historylog->add('S',$request['id'],$request['status']);
+                                       
$this->historylog->add('S',$request['id'],$request['status'],$old_status);
                                }
                                if ($old_category != $request['cat_id'])
                                {
-                                       
$this->historylog->add('T',$request['id'],$request['cat_id']);
+                                       
$this->historylog->add('T',$request['id'],$request['cat_id'],$old_category);
                                }
-                               if ($old_coordinator != $request['coordinator'])
+                               if ((int)$old_coordinator != 
(int)$request['coordinator'])
                                {
-                                       
$this->historylog->add('C',$request['id'],$request['coordinator']);
+                                       
$this->historylog->add('C',$request['id'],$request['coordinator'],$old_coordinator);
                                }
 
+                               if ($old_budget != $request['budget'])
+                               {
+                                       $this->historylog->add('B', 
$request['id'], $request['budget'], $old_budget);
+                               }
+
                                $receipt['message'][] = 
array('msg'=>lang('request %1 has been edited',$request['id']));
                        }
                        else

Modified: trunk/property/inc/class.uirequest.inc.php
===================================================================
--- trunk/property/inc/class.uirequest.inc.php  2011-08-30 12:04:36 UTC (rev 
7539)
+++ trunk/property/inc/class.uirequest.inc.php  2011-08-30 13:32:20 UTC (rev 
7540)
@@ -977,10 +977,14 @@
                                }
 
 
-                               if(isset($values['budget']) && 
$values['budget'] && !ctype_digit($values['budget']))
+                               if(isset($values['budget']) && 
$values['budget'])
                                {
-                                       
$receipt['error'][]=array('msg'=>lang('budget') . ': ' . lang('Please enter an 
integer !'));
-                                       $error_id=true;
+                                       $values['budget'] = str_replace(' ', 
'', $values['budget']);
+                                       if( !ctype_digit($values['budget']))
+                                       {
+                                               
$receipt['error'][]=array('msg'=>lang('budget') . ': ' . lang('Please enter an 
integer !'));
+                                               $error_id=true;
+                                       }
                                }
 
                                if(is_array($values_attribute))
@@ -1228,6 +1232,7 @@
                                        'values'        =>      
json_encode(array(      array('key' => 
'value_date','label'=>lang('Date'),'sortable'=>true,'resizeable'=>true),
                                                                                
                                array('key' => 
'value_user','label'=>lang('User'),'sortable'=>true,'resizeable'=>true),
                                                                                
                                array('key' => 
'value_action','label'=>lang('Action'),'sortable'=>true,'resizeable'=>true),
+                                                                               
                                array('key' => 'value_old_value','label' => 
lang('old value'), 'sortable'=>true,'resizeable'=>true),
                                                                                
                                array('key' => 
'value_new_value','label'=>lang('New 
Value'),'sortable'=>true,'resizeable'=>true)))
                                );
 
@@ -1266,15 +1271,18 @@
 
 
 
+                       $_predisposed = 0;
                        if($this->acl_edit)
                        {
                                $_lang_delete = lang('Check to delete');
                                foreach($values['consume'] as & $consume)
                                {
+                                       $_predisposed = $_predisposed + 
$consume['amount'];
                                        $consume['delete'] = "<input 
type='checkbox' name='values[delete_consume][]' value='{$consume['id']}' 
title='{$_lang_delete}'>";
                                }
                                foreach($values['planning'] as & $planning)
                                {
+                                       $_predisposed = $_predisposed + 
$planning['amount'];
                                        $planning['delete'] = "<input 
type='checkbox' name='values[delete_planning][]' value='{$planning['id']}' 
title='{$_lang_delete}'>";
                                }
 
@@ -1383,7 +1391,7 @@
 
                                        'generate_project_action'               
        => $GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
'property.uiproject.edit')),
                                        'edit_action'                           
                => $GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
'property.uirequest.edit', 'id'=> $id)),
-                                       'acl_add_project'                       
                => $this->acl->check('.project', PHPGW_ACL_ADD, 'property'),
+                                       'acl_add_project'                       
                => $mode == 'view' ? 0 : $this->acl->check('.project', 
PHPGW_ACL_ADD, 'property'),
                                        'lang_generate_project'                 
        => lang('Generate project'),
                                        'lang_generate_project_statustext'      
=> lang('Generate a project from this request'),
                                        'location_code'                         
                => $values['location_code'],
@@ -1427,8 +1435,9 @@
                                        'value_power_meter'                     
                => $values['power_meter'],
 
                                        'lang_budget'                           
                => lang('Budget'),
-                                       'value_budget'                          
                => $values['budget'],
+                                       'value_budget'                          
                => number_format($values['budget'], 0, ',', ' '),
                                        'lang_budget_statustext'                
        => lang('Enter the budget'),
+                                       'value_diff'                            
                => number_format(((int)$values['budget'] - $_predisposed), 0, 
',', ' '),
 
                                        'location_data'                         
                => $location_data,
                                        'location_type'                         
                => 'form',

Modified: trunk/property/setup/phpgw_no.lang
===================================================================
--- trunk/property/setup/phpgw_no.lang  2011-08-30 12:04:36 UTC (rev 7539)
+++ trunk/property/setup/phpgw_no.lang  2011-08-30 13:32:20 UTC (rev 7540)
@@ -187,6 +187,7 @@
 async method   property        no      async metode
 async method has been saved    property        no      async metode er lagret
 async services property        no      Planlagte oppgaver
+at the disposal        property        no      Til disposisjon
 attach file    property        no      Legg til som vedlegg
 attachments    property        no      Vedlegg
 attribute      property        no      Verdier

Modified: trunk/property/templates/base/request.xsl
===================================================================
--- trunk/property/templates/base/request.xsl   2011-08-30 12:04:36 UTC (rev 
7539)
+++ trunk/property/templates/base/request.xsl   2011-08-30 13:32:20 UTC (rev 
7540)
@@ -348,7 +348,16 @@
                                                                </td>
                                                        </tr>
                                                        <tr>
+                                                               <td 
valign="top">
+                                                                       
<xsl:value-of select="php:function('lang', 'at the disposal')" />
+                                                               </td>
                                                                <td>
+                                                                       
<xsl:value-of select="value_diff"/>
+                                                                       
<xsl:text> </xsl:text> [ <xsl:value-of select="currency"/> ]
+                                                               </td>
+                                                       </tr>
+                                                       <tr>
+                                                               <td>
                                                                        
<xsl:value-of select="php:function('lang', 'building part')" />
                                                                </td>
                                                                <td>




reply via email to

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