fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [12755] update local register on edit custom attrib


From: Sigurd Nes
Subject: [Fmsystem-commits] [12755] update local register on edit custom attrib
Date: Tue, 17 Feb 2015 13:53:10 +0000

Revision: 12755
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=12755
Author:   sigurdne
Date:     2015-02-17 13:53:06 +0000 (Tue, 17 Feb 2015)
Log Message:
-----------
update local register on edit custom attrib

Modified Paths:
--------------
    trunk/property/inc/custom/default/hent_maaler_nr_til_besikt_rapport.php

Modified: 
trunk/property/inc/custom/default/hent_maaler_nr_til_besikt_rapport.php
===================================================================
--- trunk/property/inc/custom/default/hent_maaler_nr_til_besikt_rapport.php     
2015-02-17 00:03:40 UTC (rev 12754)
+++ trunk/property/inc/custom/default/hent_maaler_nr_til_besikt_rapport.php     
2015-02-17 13:53:06 UTC (rev 12755)
@@ -139,6 +139,40 @@
                                                                }
                                                        }
                                                        break;
+                                               case 'br_slokk_app_skiftet':
+                                                       if($entry['value'])
+                                                       {
+                                                               $new_value = 
$entry['value'];
+                                                               
$this->db->query("SELECT skiftet, id FROM fm_entity_1_10 WHERE location_code 
='{$values['location_code']}'",__LINE__,__FILE__);
+                                                               
$this->db->next_record();
+                                                               $old_value = 
$this->db->f('skiftet');
+                                                               $id = 
$this->db->f('id');
+                                                               if($id)
+                                                               {
+                                                                       
$attrib_id = 2;
+                                                                       
if(strtotime($new_value) != strtotime($old_value))
+                                                                       {
+                                                                               
$historylog     = CreateObject('property.historylog','entity_1_10');
+                                                                               
$historylog->add('SO', $id, $new_value, false, $attrib_id, $besiktet_dato);
+                                                                               
$this->db->query("UPDATE fm_entity_1_10 SET skiftet = '{$new_value}' WHERE 
location_code ='{$values['location_code']}'",__LINE__,__FILE__);
+                                                                       }
+                                                               }
+                                                               else
+                                                               {
+                                                                       if 
($values['street_name'])
+                                                                       {
+                                                                               
$address = $this->db->db_addslashes($values['street_name'] . ' ' 
.$values['street_number']);
+                                                                       }
+                                                                       else
+                                                                       {
+                                                                               
$address = $this->db->db_addslashes($values['location_name']);
+                                                                       }
+
+                                                                       
$this->br_slokk_app($new_value, $values['location_code'], $address);
+                                                               }
+                                                       }
+                                                       break;
+                                               default:
                                        }
                                }
                        }
@@ -168,13 +202,45 @@
                        $value_set['location_code'] = $location_code;
                        $value_set['entry_date'] = time();
                        $value_set['user_id'] = $this->account;
-               
+
                        $cols = implode(',', array_keys($value_set));
                        $values = 
$this->db->validate_insert(array_values($value_set));
                        $this->db->query("INSERT INTO $table ({$cols}) VALUES 
({$values})",__LINE__,__FILE__);
                        $historylog     = 
CreateObject('property.historylog','entity_1_14');
                        $historylog->add('SO', $value_set['id'], $beskrivelse, 
false, $attrib_id = 1, time());
                }
+
+               private function br_slokk_app($date,$location_code,$address)
+               {
+                       $table = 'fm_entity_1_10';
+                       $location=explode('-',$location_code);
+                       $value_set = array();
+
+                       $i=1;
+                       if (isset($location) AND is_array($location))
+                       {
+                               foreach($location as $location_entry)
+                               {
+                                       $value_set["loc{$i}"] = $location_entry;
+
+                                       $i++;
+                               }
+                       }
+
+                       $value_set['id'] = $this->bocommon->next_id($table);
+                       $value_set['num'] = $value_set['id'];
+                       $value_set['address'] = $address;
+                       $value_set['skiftet'] = $date;
+                       $value_set['location_code'] = $location_code;
+                       $value_set['entry_date'] = time();
+                       $value_set['user_id'] = $this->account;
+
+                       $cols = implode(',', array_keys($value_set));
+                       $values = 
$this->db->validate_insert(array_values($value_set));
+                       $this->db->query("INSERT INTO $table ({$cols}) VALUES 
({$values})",__LINE__,__FILE__);
+                       $historylog     = 
CreateObject('property.historylog','entity_1_10');
+                       $historylog->add('SO', $value_set['id'], $date, false, 
$attrib_id = 2, time());
+               }
        }
 
        $data_sync = new entity_data_sync();




reply via email to

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