phpgroupware-cvs
[Top][All Lists]
Advanced

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

[Phpgroupware-cvs] CVS: property/inc class.soproject.inc.php, 1.28, 1.29


From: Sigurd Nes <address@hidden>
Subject: [Phpgroupware-cvs] CVS: property/inc class.soproject.inc.php, 1.28, 1.29 class.uilookup.inc.php, 1.28, 1.29 class.solocation.inc.php, 1.27, 1.28 class.bocommon.inc.php, 1.68, 1.69 class.uilocation.inc.php, 1.23, 1.24 class.uiproject.inc.php, 1.38, 1.39 class.boproject.inc.php, 1.12, 1.13
Date: Fri, 08 Aug 2003 13:08:00 -0400

Update of /cvsroot/phpgroupware/property/inc
In directory subversions:/tmp/cvs-serv5813/inc

Modified Files:
        class.soproject.inc.php class.uilookup.inc.php 
        class.solocation.inc.php class.bocommon.inc.php 
        class.uilocation.inc.php class.uiproject.inc.php 
        class.boproject.inc.php 
Log Message:
no message

Index: class.soproject.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/property/inc/class.soproject.inc.php,v
retrieving revision 1.28
retrieving revision 1.29
diff -C2 -r1.28 -r1.29
*** class.soproject.inc.php     7 Aug 2003 16:08:59 -0000       1.28
--- class.soproject.inc.php     8 Aug 2003 17:07:58 -0000       1.29
***************
*** 379,385 ****
                {
                        $this->db->query("update fm_idgenerator set value = 
value + 1 where name = 'project'");
                        $this->db->query("select value from fm_idgenerator 
where name = 'project'");
                        $this->db->next_record();
!                       $project_id = $this->db->f('value');
                        return $project_id;
                }
--- 379,389 ----
                {
                        $this->db->query("update fm_idgenerator set value = 
value + 1 where name = 'project'");
+               }
+ 
+               function next_project_id()
+               {
                        $this->db->query("select value from fm_idgenerator 
where name = 'project'");
                        $this->db->next_record();
!                       $project_id = $this->db->f('value')+1;
                        return $project_id;
                }
***************
*** 415,424 ****
                        }
  
- 
-                       
$this->historylog->add('SO',$project['project_id'],$project['status']);
-                       
$this->historylog->add('TO',$project['project_id'],$project['cat_id']);
-                       
$this->historylog->add('CO',$project['project_id'],$project['coordinator']);
- 
- 
                        if($project['street_name'])
                        {
--- 419,422 ----
***************
*** 435,465 ****
                        $project['descr'] = 
$this->db->db_addslashes($project['descr']);
                        $project['name'] = 
$this->db->db_addslashes($project['name']);
-                       $project['title'] = 
$this->db->db_addslashes($project['title']);
- _debug_array($project);
-                       $this->db->query("INSERT INTO fm_project 
(id,name,access,category,entry_date,start_date,end_date,coordinator,status,"
-                               . 
"descr,title,budget,location_code,address,key_deliver,key_fetch,other_branch,key_responsible,tenant_id,charge_tenant,user_id
 $cols) "
-                               . "VALUES ('"
-                               . $project['project_id']. "','"
-                               . $project['name']. "','"
-                               . "public','"
-                               . $project['cat_id']. "','"
-                               . time() . "','"
-                               . $project['start_date']. "','"
-                               . $project['end_date']. "','"
-                               . $project['coordinator']. "','"
-                               . $project['status']. "','"
-                               . $project['descr']. "','"
-                               . $project['title']. "','"
-                               . $project['budget']. "','"
-                               . $project['location_code']. "','"
-                               . $address . "','"
-                               . $project['key_deliver']. "','"
-                               . $project['key_fetch']. "','"
-                               . $project['other_branch']. "','"
-                               . $project['key_responsible']. "','"
-                               . $project['tenant_id']. "','"
-                               . $project['charge_tenant'] . "','"
-                               . $this->account. "' $vals 
)",__LINE__,__FILE__);
  
  
                        if($project['extra']['contact_phone'])
--- 433,466 ----
                        $project['descr'] = 
$this->db->db_addslashes($project['descr']);
                        $project['name'] = 
$this->db->db_addslashes($project['name']);
  
+                       $values= array(
+                               $project['project_id'],
+                               $project['name'],
+                               'public',
+                               $project['cat_id'],
+                               time(),
+                               $project['start_date'],
+                               $project['end_date'],
+                               $project['coordinator'],
+                               $project['status'],
+                               $project['descr'],
+                               $project['budget'],
+                               $project['location_code'],
+                               $address,
+                               $project['key_deliver'],
+                               $project['key_fetch'],
+                               $project['other_branch'],
+                               $project['key_responsible'],
+                               $project['tenant_id'],
+                               $project['charge_tenant'],
+                               $this->account);
+ 
+                       $values = $this->bocommon->validate_db_insert($values);
+ 
+                       $this->db->transaction_begin();
+ 
+                       $this->db->query("INSERT INTO fm_project 
(id,name,access,category,entry_date,start_date,end_date,coordinator,status,"
+                               . 
"descr,budget,location_code,address,key_deliver,key_fetch,other_branch,key_responsible,tenant_id,charge_tenant,user_id
 $cols) "
+                               . "VALUES ($values $vals )",__LINE__,__FILE__);
  
                        if($project['extra']['contact_phone'])
***************
*** 468,472 ****
                        }
  
- 
                        if ($project['power_meter'] )
                        {
--- 469,472 ----
***************
*** 474,478 ****
                        }
  
-       // -----------------which branch is represented
                        if (count($project['branch']) != 0)
                        {
--- 474,477 ----
***************
*** 492,496 ****
                        }
  
!                       $receipt['message'][] = array('msg'=>lang('project %1 
has been saved',$project['project_id']));
                        return $receipt;
                }
--- 491,508 ----
                        }
  
!                       $this->increment_project_id();
! 
!                       if($this->db->transaction_commit())
!                       {
!                               
$this->historylog->add('SO',$project['project_id'],$project['status']);
!                               
$this->historylog->add('TO',$project['project_id'],$project['cat_id']);
!                               
$this->historylog->add('CO',$project['project_id'],$project['coordinator']);
! 
!                               $receipt['message'][] = 
array('msg'=>lang('project %1 has been saved',$project['project_id']));
!                       }
!                       else
!                       {
!                               $receipt['error'][] = array('msg'=>lang('the 
project has not been saved'));
!                       }
                        return $receipt;
                }
***************
*** 536,540 ****
                function edit($project)
                {
- //_debug_array($project);
                        while (is_array($project['location']) && 
list($input_name,$value) = each($project['location']))
                        {
--- 548,551 ----
***************
*** 564,614 ****
                        }
  
  
!                       $this->db->query("SELECT status,category,coordinator 
FROM fm_project where id='" .$project['project_id']."'",__LINE__,__FILE__);
! 
!                       $this->db->next_record();
! 
!                       $old_status = $this->db->f('status');
!                       $old_categroy = (int)$this->db->f('category');
!                       $old_coordinator = (int)$this->db->f('coordinator');
!                       if ($old_status != $project['status'])
!                       {
!                               
$this->historylog->add('S',$project['project_id'],$project['status']);
!                       }
!                       if ($old_categroy != $project['cat_id'])
!                       {
!                               
$this->historylog->add('T',$project['project_id'],$project['cat_id']);
!                       }
!                       if ($old_coordinator != $project['coordinator'])
!                       {
!                               
$this->historylog->add('C',$project['project_id'],$project['coordinator']);
!                       }
  
  
!                       $project['descr'] = 
$this->db->db_addslashes($project['descr']);
!                       $project['name'] = 
$this->db->db_addslashes($project['name']);
!                       $project['title'] = 
$this->db->db_addslashes($project['title']);
! //_debug_array($project);
  
!                       $this->db->query("UPDATE fm_project set
!                               name                    ='" . $project['name'] 
. "',
!                               status                  ='" . 
$project['status'] . "',
!                               category                ='" . 
$project['cat_id'] . "',
!                               start_date              ='" . 
$project['start_date'] . "',
!                               end_date                ='" . 
$project['end_date'] . "',
!                               coordinator             ='" . 
$project['coordinator'] . "',
!                               descr                   ='" . $project['descr'] 
. "',
!                               title                   ='"     . 
$project['title'] . "',
!                               budget                  ='" . 
(int)$project['budget'] . "',
!                               key_deliver             ='" . 
$project['key_deliver'] . "',
!                               key_fetch               ='" . 
$project['key_fetch'] . "',
!                               other_branch    ='" . $project['other_branch'] 
. "',
!                               key_responsible ='" . 
$project['key_responsible'] . "',
!                               tenant_id               ='" . 
$project['tenant_id'] . "',
!                               charge_tenant   ='" . $project['charge_tenant'] 
. "',
!                               location_code   ='" . $project['location_code'] 
. "',
!                               address                 ='" . $address . "',
!                               equipment_id    ='" . $project['equipment_id']
!                               . "' $vals WHERE id= '" . 
$project['project_id'] ."'",__LINE__,__FILE__);
  
                        if($project['extra']['contact_phone'])
--- 575,605 ----
                        }
  
+                       $project['descr'] = 
$this->db->db_addslashes($project['descr']);
+                       $project['name'] = 
$this->db->db_addslashes($project['name']);
  
!                       $value_set=array(
!                               'name'                          => 
$project['name'],
!                               'status'                        => 
$project['status'],
!                               'category'                      => 
$project['cat_id'],
!                               'start_date'            => 
$project['start_date'],
!                               'end_date'                      => 
$project['end_date'],
!                               'coordinator'           => 
$project['coordinator'],
!                               'descr'                         => 
$project['descr'],
!                               'budget'                        => 
(int)$project['budget'],
!                               'key_deliver'           => 
$project['key_deliver'],
!                               'key_fetch'                     => 
$project['key_fetch'],
!                               'other_branch'          => 
$project['other_branch'],
!                               'key_responsible'       => 
$project['key_responsible'],
!                               'tenant_id'                     => 
$project['tenant_id'],
!                               'charge_tenant'         => 
$project['charge_tenant'],
!                               'location_code'         => 
$project['location_code'],
!                               'address'                       => $address
!                               );
  
+                       $value_set      = 
$this->bocommon->validate_db_update($value_set);
  
!                       $this->db->transaction_begin();
  
!                       $this->db->query("UPDATE fm_project set $value_set 
$vals WHERE id= '" . $project['project_id'] ."'",__LINE__,__FILE__);
  
                        if($project['extra']['contact_phone'])
***************
*** 638,644 ****
                        }
  
!                       
$this->update_request_status($project['project_id'],$project['status'],$project['cat_id'],$project['coordinator']);
  
!                       $receipt['message'][] = array('msg'=>lang('project %1 
has been edited',$project['project_id']));
                        return $receipt;
  
--- 629,658 ----
                        }
  
!                       if($this->db->transaction_commit())
!                       {
!                               
$this->update_request_status($project['project_id'],$project['status'],$project['cat_id'],$project['coordinator']);
! 
!                               $this->db->query("SELECT 
status,category,coordinator FROM fm_project where id='" 
.$project['project_id']."'",__LINE__,__FILE__);
! 
!                               $this->db->next_record();
  
!                               $old_status = $this->db->f('status');
!                               $old_categroy = (int)$this->db->f('category');
!                               $old_coordinator = 
(int)$this->db->f('coordinator');
!                               if ($old_status != $project['status'])
!                               {
!                                       
$this->historylog->add('S',$project['project_id'],$project['status']);
!                               }
!                               if ($old_categroy != $project['cat_id'])
!                               {
!                                       
$this->historylog->add('T',$project['project_id'],$project['cat_id']);
!                               }
!                               if ($old_coordinator != $project['coordinator'])
!                               {
!                                       
$this->historylog->add('C',$project['project_id'],$project['coordinator']);
!                               }
! 
!                               $receipt['message'][] = 
array('msg'=>lang('project %1 has been edited',$project['project_id']));
!                       }
                        return $receipt;
  

Index: class.uilookup.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/property/inc/class.uilookup.inc.php,v
retrieving revision 1.28
retrieving revision 1.29
diff -C2 -r1.28 -r1.29
*** class.uilookup.inc.php      7 Aug 2003 16:08:59 -0000       1.28
--- class.uilookup.inc.php      8 Aug 2003 17:07:58 -0000       1.29
***************
*** 342,346 ****
                                'lang_cat_statustext'                   => 
lang('Select the category the building belongs to. To do not use a category 
select NO CATEGORY'),
                                'select_name'                                   
=> 'cat_id',
!                               'cat_list'                                      
        => $this->cats->formatted_xslt_list(array('selected' => 
$this->cat_id,'globals' => True)),
                                'select_action'                                 
=> $GLOBALS['phpgw']->link('/index.php',$link_select),
                                'filter_list'                                   
=> $this->nextmatchs->xslt_filter(array('filter' => $this->filter,'yours' => 
'yes')),
--- 342,346 ----
                                'lang_cat_statustext'                   => 
lang('Select the category the building belongs to. To do not use a category 
select NO CATEGORY'),
                                'select_name'                                   
=> 'cat_id',
! //                            'cat_list'                                      
        => $this->cats->formatted_xslt_list(array('selected' => 
$this->cat_id,'globals' => True)),
                                'select_action'                                 
=> $GLOBALS['phpgw']->link('/index.php',$link_select),
                                'filter_list'                                   
=> $this->nextmatchs->xslt_filter(array('filter' => $this->filter,'yours' => 
'yes')),

Index: class.solocation.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/property/inc/class.solocation.inc.php,v
retrieving revision 1.27
retrieving revision 1.28
diff -C2 -r1.27 -r1.28
*** class.solocation.inc.php    7 Aug 2003 16:08:59 -0000       1.27
--- class.solocation.inc.php    8 Aug 2003 17:07:58 -0000       1.28
***************
*** 621,625 ****
  
  //_debug_array($cols_return);
! 
                        return $location;
                }
--- 621,625 ----
  
  //_debug_array($cols_return);
! //_debug_array($location);
                        return $location;
                }

Index: class.bocommon.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/property/inc/class.bocommon.inc.php,v
retrieving revision 1.68
retrieving revision 1.69
diff -C2 -r1.68 -r1.69
*** class.bocommon.inc.php      5 Aug 2003 13:32:39 -0000       1.68
--- class.bocommon.inc.php      8 Aug 2003 17:07:58 -0000       1.69
***************
*** 999,1002 ****
--- 999,1038 ----
                }
  
+               function validate_db_insert($values)
+               {
+                       foreach($values as $value)
+                       {
+                               if($value)
+                               {
+                                       $insert_value[] = "'".$value."'";
+                               }
+                               else
+                               {
+                                       $insert_value[] = 'NULL';
+                               }
+                       }
+ 
+                       $values = implode(",", $insert_value);
+                       return $values;
+               }
+ 
+               function validate_db_update($value_set)
+               {
+                       while (is_array($value_set) && list($field,$value) = 
each($value_set))
+                       {
+                               if($value)
+                               {
+                                       $value_entry[]= "$field='$value'";
+                               }
+                               else
+                               {
+                                       $value_entry[]= "$field=NULL";
+                               }
+                       }
+ 
+                       $value_set      = implode(",", $value_entry);
+                       return $value_set;
+               }
+ 
        }
  ?>

Index: class.uilocation.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/property/inc/class.uilocation.inc.php,v
retrieving revision 1.23
retrieving revision 1.24
diff -C2 -r1.23 -r1.24
*** class.uilocation.inc.php    27 Jul 2003 15:53:24 -0000      1.23
--- class.uilocation.inc.php    8 Aug 2003 17:07:58 -0000       1.24
***************
*** 179,183 ****
                                                                                
(
                                                                                
        'sort'  => $this->sort,
!                                                                               
        'var'   =>      'loc1',
                                                                                
        'order' =>      $this->order,
                                                                                
        'extra'         => array('menuaction'                   => 
$this->currentapp.'.uilocation.index',
--- 179,183 ----
                                                                                
(
                                                                                
        'sort'  => $this->sort,
!                                                                               
        'var'   =>      'fm_location1.loc1',
                                                                                
        'order' =>      $this->order,
                                                                                
        'extra'         => array('menuaction'                   => 
$this->currentapp.'.uilocation.index',
***************
*** 359,363 ****
  
                        $insert_record = 
$GLOBALS['phpgw']->session->appsession('insert_record',$this->currentapp);
! 
  
  //    _debug_array($insert_record);
--- 359,363 ----
  
                        $insert_record = 
$GLOBALS['phpgw']->session->appsession('insert_record',$this->currentapp);
!                       
$GLOBALS['phpgw']->session->appsession('insert_record',$this->currentapp,'');
  
  //    _debug_array($insert_record);
***************
*** 365,369 ****
                        if($_POST['save'])
                        {
- 
                                for ($i=0; 
$i<count($insert_record['location']); $i++)
                                {
--- 365,368 ----
***************
*** 375,379 ****
                                        $values[$insert_record['extra'][$i]]= 
$_POST[$insert_record['extra'][$i]];
                                }
- 
                        }
  
--- 374,377 ----
***************
*** 405,414 ****
                                        if($i<$type_id)
                                        {
!                                               $location_code_parent[]= 
$values['loc' . ($i)];
                                        }
                                }
  
                                $values['location_code']=implode("-", 
$values['location_code']);
- //                            $location_code_parent=implode("-", 
$location_code_parent);
  
                                if($values['location_code'] && !$location_code)
--- 403,411 ----
                                        if($i<$type_id)
                                        {
!                                               $location_parent[]= 
$values['loc' . ($i)];
                                        }
                                }
  
                                $values['location_code']=implode("-", 
$values['location_code']);
  
                                if($values['location_code'] && !$location_code)
***************
*** 433,437 ****
                                if(!$receipt['error'])
                                {
!                                       $receipt = 
$this->bo->save($values,$action,$type_id,$location_code_parent);
                                }
                        }
--- 430,442 ----
                                if(!$receipt['error'])
                                {
!                                       $receipt = 
$this->bo->save($values,$action,$type_id,$location_parent);
!                               }
!                               else
!                               {
!                                       if($location_parent)
!                                       {
!                                               
$location_code_parent=implode("-", $location_parent);
!                                               $values = 
$this->bo->read_single($location_code_parent);
!                                       }
                                }
                        }
***************
*** 439,443 ****
                        if(!$error_id && $location_code)
                        {
!                               $values = 
$this->bo->read_single($location_code);
                        }
                        else
--- 444,455 ----
                        if(!$error_id && $location_code)
                        {
!                               if (isset($insert_record['extra']) AND 
is_array($insert_record['extra']))
!                               {
!                                       foreach($insert_record['extra'] as 
$extra_entry)
!                                       {
!                                               $extra[$extra_entry]=True;
!                                       }
!                               }
!                               $values = 
$this->bo->read_single($location_code,$extra);
                        }
                        else
***************
*** 446,449 ****
--- 458,462 ----
                        }
  
+ //_debug_array($values);
                        if ($values['cat_id'] > 0)
                        {
***************
*** 471,476 ****
                                                'type_id'               => 
($type_id-1),
                                                'no_link'               => 
($type_id), // disable lookup links for location type less than type_id
!                       //                      'tenant'                => True,
!                       //                      'equipment'             => True,
                                                'lookup_type'   => $lookup_type
                                                ));
--- 484,489 ----
                                                'type_id'               => 
($type_id-1),
                                                'no_link'               => 
($type_id), // disable lookup links for location type less than type_id
!                                               'tenant'                => 
False,
!                                               'equipment'             => 
False,
                                                'lookup_type'   => $lookup_type
                                                ));
***************
*** 556,560 ****
  //    _debug_array($custom_fields);
  
!                       for ($j=0;$j<count($config);$j++)
                        {
                                if($config[$j]['location_type'] == $type_id)
--- 569,574 ----
  //    _debug_array($custom_fields);
  
!                       $config_count=count($config);
!                       for ($j=0;$j<$config_count;$j++)
                        {
                                if($config[$j]['location_type'] == $type_id)
***************
*** 565,568 ****
--- 579,583 ----
                                                $edit_street=True;
                                                $insert_record['extra'][]       
= 'street_id';
+                                               $insert_record['extra'][]       
= 'street_number';
                                        }
  

Index: class.uiproject.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/property/inc/class.uiproject.inc.php,v
retrieving revision 1.38
retrieving revision 1.39
diff -C2 -r1.38 -r1.39
*** class.uiproject.inc.php     27 Jul 2003 15:53:24 -0000      1.38
--- class.uiproject.inc.php     8 Aug 2003 17:07:58 -0000       1.39
***************
*** 432,435 ****
--- 432,441 ----
                                }
  
+                               if(!$values['coordinator'])
+                               {
+                                       
$receipt['error'][]=array('msg'=>lang('Please select a coordinator !'));
+                                       $error_id=true;
+                               }
+ 
                                if(!$values['status'])
                                {
***************
*** 447,451 ****
                                        if(!$id)
                                        {
!                                               
$values['project_id']=$this->bo->increment_project_id();
                                                $id     = $values['project_id'];
                                        }
--- 453,457 ----
                                        if(!$id)
                                        {
!                                               
$values['project_id']=$this->bo->next_project_id();
                                                $id     = $values['project_id'];
                                        }
***************
*** 454,463 ****
                                        {
                                                $action='add';
!                                               $values['project_id']   = 
$this->bo->increment_project_id();
                                                $id     = $values['project_id'];
                                        }
                                        $receipt = 
$this->bo->save($values,$action);
!                                       $id = $values['project_id'];
!                                       $function_msg = lang('Edit Project');
  
                                        if ($values['approval'])
--- 460,472 ----
                                        {
                                                $action='add';
!                                               $values['project_id']   = 
$this->bo->next_project_id();
                                                $id     = $values['project_id'];
                                        }
                                        $receipt = 
$this->bo->save($values,$action);
!                                       if($receipt['error'])
!                                       {
!                                               unset($id);
!                                               unset($values['project_id']);
!                                       }
  
                                        if ($values['approval'])
***************
*** 491,495 ****
                                        }
                                }
!                               else
                                {
                                        if($values['location'])
--- 500,505 ----
                                        }
                                }
! 
!                               if($receipt['error'])
                                {
                                        if($values['location'])

Index: class.boproject.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/property/inc/class.boproject.inc.php,v
retrieving revision 1.12
retrieving revision 1.13
diff -C2 -r1.12 -r1.13
*** class.boproject.inc.php     9 Jul 2003 11:12:16 -0000       1.12
--- class.boproject.inc.php     8 Aug 2003 17:07:58 -0000       1.13
***************
*** 434,440 ****
  
  
!               function increment_project_id()
                {
!                       return $this->so->increment_project_id();
                }
  
--- 434,440 ----
  
  
!               function next_project_id()
                {
!                       return $this->so->next_project_id();
                }
  





reply via email to

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