phpgroupware-cvs
[Top][All Lists]
Advanced

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

[Phpgroupware-cvs] property/inc class.socategory.inc.php, 1.11 hook_admi


From: sigurdne
Subject: [Phpgroupware-cvs] property/inc class.socategory.inc.php, 1.11 hook_admin.inc.php, 1.17 class.uirequest.inc.php, 1.15 class.sorequest.inc.php, 1.10 class.borequest.inc.php, 1.8
Date: Wed, 21 Sep 2005 16:18:00 +0200

Update of property/inc

Modified Files:
     Branch: MAIN
            class.socategory.inc.php lines: +4 -1
            hook_admin.inc.php lines: +2 -1
            class.uirequest.inc.php lines: +20 -94
            class.sorequest.inc.php lines: +78 -150
            class.borequest.inc.php lines: +22 -98

Log Message:
no message

====================================================
Index: property/inc/class.socategory.inc.php
diff -u property/inc/class.socategory.inc.php:1.10 
property/inc/class.socategory.inc.php:1.11
--- property/inc/class.socategory.inc.php:1.10  Fri Sep  9 10:52:13 2005
+++ property/inc/class.socategory.inc.php       Wed Sep 21 14:18:20 2005
@@ -155,6 +155,9 @@
                                case 'wo_hours':
                                        $table='fm_wo_hours_category';
                                        break;
+                               case 'r_condition_type':
+                                       $table='fm_request_condition_type';
+                                       break;
                        }

                        return $table;

====================================================
Index: property/inc/hook_admin.inc.php
diff -u property/inc/hook_admin.inc.php:1.16 
property/inc/hook_admin.inc.php:1.17
--- property/inc/hook_admin.inc.php:1.16        Fri Sep  9 10:52:13 2005
+++ property/inc/hook_admin.inc.php     Wed Sep 21 14:18:20 2005
@@ -43,6 +43,7 @@
                                'Permissions'=> 
$GLOBALS['phpgw']->link('/index.php','menuaction='.$appname.'.uiadmin.list_acl2'),
                                'User contact info'=> 
$GLOBALS['phpgw']->link('/index.php','menuaction='.$appname.'.uiadmin.contact_info'),
                                'Request status'=> 
$GLOBALS['phpgw']->link('/index.php','menuaction='.$appname.'.uistandard_2.index&type=request_status'),
+                               'Request condition_type'=> 
$GLOBALS['phpgw']->link('/index.php','menuaction='.$appname.'.uicategory.index&type=r_condition_type'),
                                'Workorders status'=> 
$GLOBALS['phpgw']->link('/index.php','menuaction='.$appname.'.uistandard_2.index&type=workorder_status'),
                                'Agreement status'=> 
$GLOBALS['phpgw']->link('/index.php','menuaction='.$appname.'.uistandard_2.index&type=agreement_status'),
                                'Agreement Attributes'=> 
$GLOBALS['phpgw']->link('/index.php','menuaction='.$appname.'.uiagreement.list_attribute'),

====================================================
Index: property/inc/class.uirequest.inc.php
diff -u property/inc/class.uirequest.inc.php:1.14 
property/inc/class.uirequest.inc.php:1.15
--- property/inc/class.uirequest.inc.php:1.14   Wed Aug 10 19:39:42 2005
+++ property/inc/class.uirequest.inc.php        Wed Sep 21 14:18:20 2005
@@ -433,7 +433,7 @@

                        if($values['update'])
                        {
-                               $receipt        = 
$this->bo->update_priority_key($values);
+                               $receipt = 
$this->bo->update_priority_key($values);
                        }

                        $function_msg   = lang('Edit priority key');
@@ -450,25 +450,12 @@
                                'msgbox_data'                                   
=> $GLOBALS['phpgw']->common->msgbox($msgbox_data),
                                'function_msg'                                  
=> $function_msg,
                                'form_action'                                   
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
-                               'lang_safety'                                   
=> lang('safety'),
-                               'lang_aesthetics'                               
=> lang('aesthetics'),
-                               'lang_indoor_climate'                   => 
lang('indoor climate'),
-                               'lang_consequential_damage'             => 
lang('consequential damage'),
-                               'lang_user_gratification'               => 
lang('user gratification'),
-                               'lang_residential_environment'  => 
lang('residential environment'),
-                               'lang_authorities_demands'              => 
lang('authorities demands'),
-                               'safety'                                        
        => $priority_key['safety'],
-                               'aesthetics'                                    
=> $priority_key['aesthetics'],
-                               'indoor_climate'                                
=> $priority_key['indoor_climate'],
-                               'consequential_damage'                  => 
$priority_key['consequential_damage'],
-                               'user_gratification'                    => 
$priority_key['user_gratification'],
-                               'residential_environment'               => 
$priority_key['residential_environment'],
-                               'authorities_demands'                   => 
$priority_key['authorities_demands'],
-                               'lang_save'                                     
        => lang('save'),
-                               'select_name'                                   
=> 'period'
+                               'lang_priority_key_statustext'                  
=> lang('Weight for prioritising'),
+                               'lang_save'                                     
=> lang('save'),
+                               'priority_key'                          => 
$priority_key,
                        );

-                       
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('priority_key' => $data));
+                       
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('priority_form' => $data));
                //      $GLOBALS['phpgw']->xslttpl->pp();
                }

@@ -781,46 +768,6 @@
                                'lang_consequence'              => 
lang('Consequence')
                        );

-                       $importance_weight[] = array
-                       (
-                               'lang_safety'                                   
                        => lang('Safety'),
-                               'lang_aesthetics'                               
                        => lang('Aesthetics'),
-                               'lang_indoor_climate'                           
                => lang('Indoor climate'),
-                               'lang_consequential_damage'                     
                => lang('Consequential damage'),
-                               'lang_user_gratification'                       
                => lang('User gratification'),
-                               'lang_residential_environment'                  
        => lang('Residential environment'),
-
-                               'lang_degree_statustext'                        
                => lang('Select the appropriate condition degree'),
-                               'lang_probability_statustext'                   
        => lang('Select the appropriate propability for worsening of the 
condition'),
-                               'lang_consequence_statustext'                   
        => lang('Select the appropriate consequence by breakdown of this 
component for this theme'),
-
-
-                               'degree_list_safety'                            
                => 
$this->bo->select_degree_list($values['d_safety'],'default_safety'),
-                               'degree_list_aesthetics'                        
                => 
$this->bo->select_degree_list($values['d_aesthetics'],'default_aesthetics'),
-                               'degree_list_indoor_climate'                    
        => 
$this->bo->select_degree_list($values['d_indoor_climate'],'default_climate'),
-                               'degree_list_consequential_damage'              
        => 
$this->bo->select_degree_list($values['d_consequential_damage'],'default_consequential_damage'),
-                               'degree_list_user_gratification'                
        => 
$this->bo->select_degree_list($values['d_user_gratification'],'default_gratification'),
-                               'degree_list_residential_environment'           
=> 
$this->bo->select_degree_list($values['d_residential_environment'],'default_environment'),
-
-
-                               'probability_list_safety'                       
                => $this->bo->select_probability_list($values['p_safety']),
-                               'probability_list_aesthetics'                   
        => $this->bo->select_probability_list($values['p_aesthetics']),
-                               'probability_list_indoor_climate'               
        => $this->bo->select_probability_list($values['p_indoor_climate']),
-                               'probability_list_consequential_damage'         
=> $this->bo->select_probability_list($values['p_consequential_damage']),
-                               'probability_list_user_gratification'           
=> $this->bo->select_probability_list($values['p_user_gratification']),
-                               'probability_list_residential_environment'      
=> $this->bo->select_probability_list($values['p_residential_environment']),
-
-                               'consequence_list_safety'                       
                => $this->bo->select_consequence_list($values['c_safety']),
-                               'consequence_list_aesthetics'                   
        => $this->bo->select_consequence_list($values['c_aesthetics']),
-                               'consequence_list_indoor_climate'               
        => $this->bo->select_consequence_list($values['c_indoor_climate']),
-                               'consequence_list_consequential_damage'         
=> $this->bo->select_consequence_list($values['c_consequential_damage']),
-                               'consequence_list_user_gratification'           
=> $this->bo->select_consequence_list($values['c_user_gratification']),
-                               'consequence_list_residential_environment'      
=> $this->bo->select_consequence_list($values['c_residential_environment']),
-
-                               'lang_authorities_demands'                      
                => lang('Authorities Demands'),
-                               'lang_authorities_demands_statustext'           
=> lang('Is there a demand from the authorities to correct this condition?'),
-                               'authorities_demands'                           
        => $values['authorities_demands']
-                       );

                        if($values['project_id'])
                        {
@@ -991,7 +938,14 @@
                                'lang_notify_statustext'                => 
lang('Check this to notify your supervisor by email'),
                                'value_notify_mail_address'             => 
$supervisor_email,

-                               'currency'                                      
        => $GLOBALS['phpgw_info']['user']['preferences']['common']['currency']
+                               'currency'                              => 
$GLOBALS['phpgw_info']['user']['preferences']['common']['currency'],
+
+                               'lang_authorities_demands'                      
=> lang('Authorities Demands'),
+                               'lang_authorities_demands_statustext'           
=> lang('Is there a demand from the authorities to correct this condition?'),
+                               'authorities_demands'                           
=> $values['authorities_demands'],
+
+                               'condition_list'                                
=> $this->bo->select_conditions($id),
+
                        );

                        $appname                                                
= lang('request');
@@ -1119,39 +1073,6 @@
                                'lang_consequence'              => 
lang('Consequence')
                        );

-                       $importance_weight[] = array
-                       (
-                               'lang_safety'                                   
                => lang('Safety'),
-                               'lang_aesthetics'                               
                => lang('Aesthetics'),
-                               'lang_indoor_climate'                           
        => lang('Indoor climate'),
-                               'lang_consequential_damage'                     
        => lang('Consequential damage'),
-                               'lang_user_gratification'                       
        => lang('User gratification'),
-                               'lang_residential_environment'                  
=> lang('Residential environment'),
-
-                               'degree_safety'                                 
                => $values['d_safety'],
-                               'degree_aesthetics'                             
                => $values['d_aesthetics'],
-                               'degree_indoor_climate'                         
        => $values['d_indoor_climate'],
-                               'degree_consequential_damage'                   
=> $values['d_consequential_damage'],
-                               'degree_user_gratification'                     
        => $values['d_user_gratification'],
-                               'degree_residential_environment'                
=> $values['d_residential_environment'],
-
-                               'probability_safety'                            
        => $values['p_safety'],
-                               'probability_aesthetics'                        
        => $values['p_aesthetics'],
-                               'probability_indoor_climate'                    
=> $values['p_indoor_climate'],
-                               'probability_consequential_damage'              
=> $values['p_consequential_damage'],
-                               'probability_user_gratification'                
=> $values['p_user_gratification'],
-                               'probability_residential_environment'   => 
$values['p_residential_environment'],
-
-                               'consequence_safety'                            
        => $values['c_safety'],
-                               'consequence_aesthetics'                        
        => $values['c_aesthetics'],
-                               'consequence_indoor_climate'                    
=> $values['c_indoor_climate'],
-                               'consequence_consequential_damage'              
=> $values['c_consequential_damage'],
-                               'consequence_user_gratification'                
=> $values['c_user_gratification'],
-                               'consequence_residential_environment'   => 
$values['c_residential_environment'],
-
-                               'lang_authorities_demands'                      
        => lang('Authorities Demands'),
-                               'authorities_demands'                           
        => $values['authorities_demands']
-                       );


                        if($values['origin']== 'tts')
@@ -1288,7 +1209,12 @@
                                'lang_edit'                                     
                => lang('Edit'),
                                'currency'                                      
                => 
$GLOBALS['phpgw_info']['user']['preferences']['common']['currency'],
                                'lang_contact_phone'                    => 
lang('Contact phone'),
-                               'contact_phone'                                 
=> $values['contact_phone']
+                               'contact_phone'                                 
=> $values['contact_phone'],
+
+                               'lang_authorities_demands'                      
=> lang('Authorities Demands'),
+                               'authorities_demands'                           
=> $values['authorities_demands'],
+
+                               'condition_list_view'                           
=> $this->bo->select_conditions($id),
                        );

                        $appname                                                
= lang('request');

====================================================
Index: property/inc/class.sorequest.inc.php
diff -u property/inc/class.sorequest.inc.php:1.9 
property/inc/class.sorequest.inc.php:1.10
--- property/inc/class.sorequest.inc.php:1.9    Fri Aug 19 11:56:50 2005
+++ property/inc/class.sorequest.inc.php        Wed Sep 21 14:18:20 2005
@@ -50,16 +50,16 @@

                function read_priority_key()
                {
-                       $this->db->query("SELECT * FROM 
fm_request_priority_key",__LINE__,__FILE__);
+                       $this->db->query("SELECT * FROM 
fm_request_condition_type",__LINE__,__FILE__);

-                       $this->db->next_record();
-                       $priority_key['safety']                                 
        = $this->db->f('safety');
-                       $priority_key['aesthetics']                             
        = $this->db->f('aesthetics');
-                       $priority_key['indoor_climate']                         
= $this->db->f('indoor_climate');
-                       $priority_key['consequential_damage']           = 
$this->db->f('consequential_damage');
-                       $priority_key['user_gratification']                     
= $this->db->f('user_gratification');
-                       $priority_key['residential_environment']        = 
$this->db->f('residential_environment');
-                       $priority_key['authorities_demands']            = 
$this->db->f('authorities_demands');
+                       while ($this->db->next_record())
+                       {
+                               $priority_key[] = array(
+                                       'id'            => $this->db->f('id'),
+                                       'descr'         => 
$this->db->f('descr'),
+                                       'priority_key'  => 
$this->db->f('priority_key')
+                                       );
+                       }

                        return $priority_key;
                }
@@ -67,25 +67,12 @@
                function update_priority_key($values)
                {

-                       
$values['safety']=str_replace(",",".",$values['safety']);
-                       
$values['aesthetics']=str_replace(",",".",$values['aesthetics']);
-                       
$values['indoor_climate']=str_replace(",",".",$values['indoor_climate']);
-                       
$values['consequential_damage']=str_replace(",",".",$values['consequential_damage']);
-                       
$values['user_gratification']=str_replace(",",".",$values['user_gratification']);
-                       
$values['residential_environment']=str_replace(",",".",$values['residential_environment']);
-                       
$values['authorities_demands']=str_replace(",",".",$values['authorities_demands']);
-
-
-                       $this->db->query("UPDATE fm_request_priority_key set
-                               safety  ='" . $values['safety'] . "',
-                               aesthetics      ='" . $values['aesthetics'] . 
"',
-                               indoor_climate  ='" . $values['indoor_climate'] 
. "',
-                               consequential_damage    ='" . 
$values['consequential_damage'] . "',
-                               user_gratification      ='" . 
$values['user_gratification'] . "',
-                               residential_environment ='" . 
$values['residential_environment'] . "',
-                               authorities_demands     ='" . 
$values['authorities_demands'] ."'",__LINE__,__FILE__);
+                       while (is_array($values['priority_key']) && 
list($id,$priority_key) = each($values['priority_key']))
+                       {
+                               $this->db->query("UPDATE 
fm_request_condition_type SET priority_key = $priority_key WHERE id = 
$id",__LINE__,__FILE__);
+                       }

-                       $this->update_score($values,'');
+                       $this->update_score();

                        $receipt['message'][] = array('msg'=> lang('priority 
keys has been updated'));
                        return $receipt;
@@ -93,37 +80,33 @@
                }


-               function update_score($priority_key,$request_id='')
+               function update_score($request_id='')
                {
                        if(!$priority_key)
                        {
-                               $priority_key = $this->read_priority_key();
+//                             $priority_key = $this->read_priority_key();
                        }

-//_debug_array($priority_key);
-
-                       $safety                                         = 
$priority_key['safety'];
-                       $aesthetics                                     = 
$priority_key['aesthetics'];
-                       $indoor_climate                         = 
$priority_key['indoor_climate'];
-                       $consequential_damage           = 
$priority_key['consequential_damage'];
-                       $user_gratification                     = 
$priority_key['user_gratification'];
-                       $residential_environment        = 
$priority_key['residential_environment'];
-                       $authorities_demands            = 
$priority_key['authorities_demands'];

                        if($request_id)
                        {
-                               $where =" WHERE id = $request_id";
+                               $request[] = $request_id;
+                       }
+                       else
+                       {
+                               $this->db->query("SELECT id FROM 
fm_request",__LINE__,__FILE__);
+
+                               while ($this->db->next_record())
+                               {
+                                       $request[] = $this->db->f('id');
+                               }
                        }

-                       $this->db->query("UPDATE fm_request SET score="
-                       . "  ($safety* (d_safety*p_safety*(c_safety+1)))"
-                       . "+ ($aesthetics* 
(d_aesthetics*p_aesthetics*(c_aesthetics+1)))"
-                       . "+ ($indoor_climate* 
(d_indoor_climate*p_indoor_climate*(c_indoor_climate+1)))"
-                       . "+ ($consequential_damage* 
(d_consequential_damage*p_consequential_damage*(c_consequential_damage+1)))"
-                       . "+ ($user_gratification* 
(d_user_gratification*p_user_gratification*(c_user_gratification+1)))"
-                       . "+ ($residential_environment* 
(d_residential_environment*p_residential_environment*(c_residential_environment+1)))"
-                       . "+ ($authorities_demands* authorities_demands) $where 
",__LINE__,__FILE__);
-
+                       while (is_array($request) && list(,$id) = 
each($request))
+                       {
+                               $this->db->query("UPDATE fm_request SET score = 
(SELECT sum (priority_key*(degree*probability*(consequence+1))) from 
fm_request_condition"
+                                . " $this->join  fm_request_condition_type ON 
(fm_request_condition.condition_type = fm_request_condition_type.id) WHERE 
request_id = $id) WHERE fm_request.id = $id",__LINE__,__FILE__);
+                       }
                }


@@ -148,34 +131,36 @@
                        return $status_entries;
                }

-               function select_branch_list()
+               function select_condition_type_list()
                {
-                       $this->db->query("SELECT id, descr FROM fm_branch ORDER 
BY id ");
+                       $this->db->query("SELECT id, descr FROM 
fm_request_condition_type ORDER BY id ");

                        $i = 0;
                        while ($this->db->next_record())
                        {
-                               $branch_entries[$i]['id']                       
        = $this->db->f('id');
-                               $branch_entries[$i]['name']                     
        = stripslashes($this->db->f('descr'));
+                               $condition_type_list[$i]['id']          = 
$this->db->f('id');
+                               $condition_type_list[$i]['name']        = 
stripslashes($this->db->f('descr'));
                                $i++;
                        }
-                       return $branch_entries;
+                       return $condition_type_list;
                }

-               function select_key_location_list()
+               function 
select_conditions($request_id='',$condition_type_list='')
                {
-                       $this->db->query("SELECT id, descr FROM fm_key_loc 
ORDER BY descr ");
-
-                       $i = 0;
-                       while ($this->db->next_record())
+                       for ($i=0;$i<count($condition_type_list);$i++)
                        {
-                               $key_location_entries[$i]['id']                 
        = $this->db->f('id');
-                               $key_location_entries[$i]['name']               
        = stripslashes($this->db->f('descr'));
-                               $i++;
+                               $this->db->query("SELECT 
degree,probability,consequence FROM fm_request_condition WHERE 
request_id=$request_id AND condition_type =" . $condition_type_list[$i]['id']);
+                               $this->db->next_record();
+                               $conditions[$i]['request_id']           = 
$request_id;
+                               $conditions[$i]['degree']               = 
$this->db->f('degree');
+                               $conditions[$i]['probability']          = 
$this->db->f('probability');
+                               $conditions[$i]['consequence']          = 
$this->db->f('consequence');
                        }
-                       return $key_location_entries;
+
+                       return $conditions;
                }

+
                function read($data)
                {
                        if(is_array($data))
@@ -339,24 +324,6 @@
                                $request['cat_id']                              
                = $this->db->f('category');

                                $request['branch_id']                           
        = $this->db->f('branch_id');
-                               $request['d_safety']                            
        = $this->db->f('d_safety');
-                               $request['d_aesthetics']                        
        = $this->db->f('d_aesthetics');
-                               $request['d_indoor_climate']                    
= $this->db->f('d_indoor_climate');
-                               $request['d_consequential_damage']              
= $this->db->f('d_consequential_damage');
-                               $request['d_user_gratification']                
= $this->db->f('d_user_gratification');
-                               $request['d_residential_environment']   = 
$this->db->f('d_residential_environment');
-                               $request['c_safety']                            
        = $this->db->f('c_safety');
-                               $request['c_aesthetics']                        
        = $this->db->f('c_aesthetics');
-                               $request['c_indoor_climate']                    
= $this->db->f('c_indoor_climate');
-                               $request['c_consequential_damage']              
= $this->db->f('c_consequential_damage');
-                               $request['c_user_gratification']                
= $this->db->f('c_user_gratification');
-                               $request['c_residential_environment']   = 
$this->db->f('c_residential_environment');
-                               $request['p_safety']                            
        = $this->db->f('p_safety');
-                               $request['p_aesthetics']                        
        = $this->db->f('p_aesthetics');
-                               $request['p_indoor_climate']                    
= $this->db->f('p_indoor_climate');
-                               $request['p_consequential_damage']              
= $this->db->f('p_consequential_damage');
-                               $request['p_user_gratification']                
= $this->db->f('p_user_gratification');
-                               $request['p_residential_environment']   = 
$this->db->f('p_residential_environment');
                                $request['authorities_demands']                 
= $this->db->f('authorities_demands');
                                $request['score']                               
                = $this->db->f('score');
                                $request['p_num']                               
                = $this->db->f('p_num');
@@ -425,17 +392,6 @@
                        return $budget;
                }

-               function branch_p_list($request_id = '')
-               {
-
-                       $this->db2->query("SELECT branch_id from 
fm_requestbranch WHERE request_id='$request_id' ",__LINE__,__FILE__);
-                       while ($this->db2->next_record())
-                       {
-                               $selected[] = array('branch_id' => 
$this->db2->f('branch_id'));
-                       }
-
-                       return $selected;
-               }

                function increment_request_id()
                {
@@ -506,24 +462,6 @@
                                $request['status'],
                                $request['branch_id'],
                                $request['coordinator'],
-                               $request['d_safety'],
-                               $request['d_aesthetics'],
-                               $request['d_indoor_climate'],
-                               $request['d_consequential_damage'],
-                               $request['d_user_gratification'],
-                               $request['d_residential_environment'],
-                               $request['c_safety'],
-                               $request['c_aesthetics'],
-                               $request['c_indoor_climate'],
-                               $request['c_consequential_damage'],
-                               $request['c_user_gratification'],
-                               $request['c_residential_environment'],
-                               $request['p_safety'],
-                               $request['p_aesthetics'],
-                               $request['p_indoor_climate'],
-                               $request['p_consequential_damage'],
-                               $request['p_user_gratification'],
-                               $request['p_residential_environment'],
                                $request['authorities_demands']);

                        $values = $this->bocommon->validate_db_insert($values);
@@ -532,13 +470,23 @@

                        $this->db->query("insert into fm_request 
(id,title,owner,category,descr,location_code,"
                                . 
"address,entry_date,budget,status,branch_id,coordinator,"
-                               . 
"d_safety,d_aesthetics,d_indoor_climate,d_consequential_damage,d_user_gratification,d_residential_environment,"
-                               . 
"c_safety,c_aesthetics,c_indoor_climate,c_consequential_damage,c_user_gratification,c_residential_environment,"
-                               . 
"p_safety,p_aesthetics,p_indoor_climate,p_consequential_damage,p_user_gratification,p_residential_environment,authorities_demands
  $cols) "
+                               . "authorities_demands  $cols) "
                                . "VALUES ($values $vals )",__LINE__,__FILE__);

+                       while (is_array($request['condition']) && 
list($condition_type,$value_type) = each($request['condition']))
+                       {
+                               $this->db->query("INSERT INTO 
fm_request_condition 
(request_id,condition_type,degree,probability,consequence,user_id,entry_date) "
+                                       . "VALUES ('"
+                                       . $request['request_id']. "','"
+                                       . $condition_type . "',"
+                                       . $value_type['degree']. ","
+                                       . $value_type['probability']. ","
+                                       . $value_type['consequence']. ","
+                                       . $this->account . ","
+                                       . time() . ")",__LINE__,__FILE__);
+                       }

-                       $this->update_score('',$request['request_id']);
+                       $this->update_score($request['request_id']);


                        if($request['extra']['contact_phone'] && 
$request['extra']['tenant_id'])
@@ -614,45 +562,23 @@
                        $request['title'] = 
$this->db->db_addslashes($request['title']);
 //_debug_array($request);

-                       $value_set=array(
-                               'status'                                => 
$request['status'],
-                               'category'                              => 
$request['cat_id'],
-                               'coordinator'                   => 
$request['coordinator'],
-                               'descr'                                 => 
$request['descr'],
-                               'title'                                 => 
$request['title'],
-                               'budget'                                => 
(int)$request['budget'],
-                               'location_code'                 => 
$request['location_code'],
-                               'floor'                                 => 
$request['floor'],
-                               'branch_id'                             => 
$request['branch_id'],
-                               'd_safety'                              => 
$request['d_safety'],
-                               'd_aesthetics'                  => 
$request['d_aesthetics'],
-                               'd_indoor_climate'              => 
$request['d_indoor_climate'],
-                               'd_consequential_damage'=> 
$request['d_consequential_damage'],
-                               'd_user_gratification'  => 
$request['d_user_gratification'],
-                               'd_residential_environment'     => 
$request['d_residential_environment'],
-                               'c_safety'                              => 
$request['c_safety'],
-                               'c_aesthetics'                  => 
$request['c_aesthetics'],
-                               'c_indoor_climate'              => 
$request['c_indoor_climate'],
-                               'c_consequential_damage'=> 
$request['c_consequential_damage'],
-                               'c_user_gratification'  => 
$request['c_user_gratification'],
-                               'c_residential_environment'     => 
$request['c_residential_environment'],
-                               'p_safety'                              => 
$request['p_safety'],
-                               'p_aesthetics'                  => 
$request['p_aesthetics'],
-                               'p_indoor_climate'              => 
$request['p_indoor_climate'],
-                               'p_consequential_damage'=> 
$request['p_consequential_damage'],
-                               'p_user_gratification'  => 
$request['p_user_gratification'],
-                               'p_residential_environment'     => 
$request['p_residential_environment'],
-                               'authorities_demands'   => 
$request['authorities_demands'],
-                               'address'                               => 
$address
-                               );
-
-                       $value_set      = 
$this->bocommon->validate_db_update($value_set);
-
                        $this->db->transaction_begin();

-                       $this->db->query("UPDATE fm_request set $value_set 
$vals WHERE id= '" . $request['request_id'] ."'",__LINE__,__FILE__);
+                       $this->db->query("DELETE FROM fm_request_condition 
WHERE request_id='" . $request['request_id'] . "'",__LINE__,__FILE__);
+                       while (is_array($request['condition']) && 
list($condition_type,$value_type) = each($request['condition']))
+                       {
+                               $this->db->query("INSERT INTO 
fm_request_condition 
(request_id,condition_type,degree,probability,consequence,user_id,entry_date) "
+                                       . "VALUES ('"
+                                       . $request['request_id']. "','"
+                                       . $condition_type . "',"
+                                       . $value_type['degree']. ","
+                                       . $value_type['probability']. ","
+                                       . $value_type['consequence']. ","
+                                       . $this->account . ","
+                                       . time() . ")",__LINE__,__FILE__);
+                       }

-                       $this->update_score('',$request['request_id']);
+                       $this->update_score($request['request_id']);

                        if($request['extra']['contact_phone'] && 
$request['extra']['tenant_id'])
                        {
@@ -698,8 +624,10 @@
                function delete($request_id )
                {
                        $this->db->query("DELETE FROM fm_request WHERE id='" . 
$request_id . "'",__LINE__,__FILE__);
+                       $this->db->query("DELETE FROM fm_request_condition 
WHERE request_id='" . $request_id . "'",__LINE__,__FILE__);
                        $this->db->query("DELETE FROM fm_request_history  WHERE 
 history_record_id='" . $request_id   . "'",__LINE__,__FILE__);
                        $this->db->query("DELETE FROM fm_origin WHERE 
destination = 'request' AND destination_id='" . $request_id . 
"'",__LINE__,__FILE__);
+
                }
        }
 ?>

====================================================
Index: property/inc/class.borequest.inc.php
diff -u property/inc/class.borequest.inc.php:1.7 
property/inc/class.borequest.inc.php:1.8
--- property/inc/class.borequest.inc.php:1.7    Thu May 12 21:26:28 2005
+++ property/inc/class.borequest.inc.php        Wed Sep 21 14:18:17 2005
@@ -244,6 +244,27 @@
                        return $probability_list;
                }

+               function select_conditions($request_id='')
+               {
+                       $condition_type_list = 
$this->so->select_condition_type_list();
+
+                       if($request_id)
+                       {
+                               $conditions = 
$this->so->select_conditions($request_id,$condition_type_list);
+                       }
+
+                       for ($i=0;$i<count($condition_type_list);$i++)
+                       {
+                               $conditions[$i]['degree']               = 
$this->select_degree_list($conditions[$i]['degree']);
+                               $conditions[$i]['probability']          = 
$this->select_probability_list($conditions[$i]['probability']);
+                               $conditions[$i]['consequence']          = 
$this->select_consequence_list($conditions[$i]['consequence']);
+                               $conditions[$i]['condition_type']       = 
$condition_type_list[$i]['id'];
+                               $conditions[$i]['condition_type_name']  = 
$condition_type_list[$i]['name'];
+                       }
+
+                       return $conditions;
+               }
+
                function 
select_consequence_list($consequence_value='',$consequencedefault_type='')
                {
                        if ($consequence_value)
@@ -314,103 +335,6 @@
                        return $status_list;
                }

-               function select_branch_list($selected='')
-               {
-
-                       $branch_entries= $this->so->select_branch_list();
-
-                       while (is_array($branch_entries) && list(,$branch) = 
each($branch_entries))
-                       {
-                               $sel_branch = '';
-                               if ($branch['id']==$selected)
-                               {
-                                       $sel_branch = 'selected';
-                               }
-
-                               $branch_list[] = array
-                               (
-                                       'id'            => $branch['id'],
-                                       'name'          => $branch['name'],
-                                       'selected'      => $sel_branch
-                               );
-                       }
-
-                       for ($i=0;$i<count($branch_list);$i++)
-                       {
-                               if ($branch_list[$i]['selected'] != 'selected')
-                               {
-                                       unset($branch_list[$i]['selected']);
-                               }
-                       }
-
-                       return $branch_list;
-               }
-
-               function select_branch_p_list($request_id='')
-               {
-
-                       $selected               = 
$this->so->branch_p_list($request_id);
-                       $branch_entries = $this->so->select_branch_list();
-
-                       $j=0;
-                       while (is_array($branch_entries) && list(,$branch) = 
each($branch_entries))
-                       {
-                               $branch_list[$j]['id'] = $branch['id'];
-                               $branch_list[$j]['name'] = $branch['name'];
-
-                               for ($i=0;$i<count($selected);$i++)
-                               {
-                                       if($selected[$i]['branch_id'] == 
$branch['id'])
-                                       {
-                                               $branch_list[$j]['selected'] = 
'selected';
-                                       }
-                               }
-                               $j++;
-                       }
-
-                       for ($i=0;$i<count($branch_list);$i++)
-                       {
-                               if ($branch_list[$i]['selected'] != 'selected')
-                               {
-                                       unset($branch_list[$i]['selected']);
-                               }
-                       }
-
-                       return $branch_list;
-               }
-
-
-               function select_key_location_list($selected='')
-               {
-
-                       $key_location_entries= 
$this->so->select_key_location_list();
-
-                       while (is_array($key_location_entries) && 
list(,$key_location) = each($key_location_entries))
-                       {
-                               $sel_key_location = '';
-                               if ($key_location['id']==$selected)
-                               {
-                                       $sel_key_location = 'selected';
-                               }
-
-                               $key_location_list[] = array
-                               (
-                                       'id'            => $key_location['id'],
-                                       'name'          => 
$key_location['name'],
-                                       'selected'      => $sel_key_location
-                               );
-                       }
-
-                       for ($i=0;$i<count($key_location_list);$i++)
-                       {
-                               if ($key_location_list[$i]['selected'] != 
'selected')
-                               {
-                                       
unset($key_location_list[$i]['selected']);
-                               }
-                       }
-
-                       return $key_location_list;
-               }

                function select_category_request_list($format='',$selected='')
                {






reply via email to

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