phpgroupware-cvs
[Top][All Lists]
Advanced

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

[Phpgroupware-cvs] sms/bin log_firealarm.php


From: Sigurd Nes
Subject: [Phpgroupware-cvs] sms/bin log_firealarm.php
Date: Thu, 21 Sep 2006 13:50:50 +0000

CVSROOT:        /sources/phpgroupware
Module name:    sms
Changes by:     Sigurd Nes <sigurdne>   06/09/21 13:50:50

Modified files:
        bin            : log_firealarm.php 

Log message:
        fix

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/sms/bin/log_firealarm.php?cvsroot=phpgroupware&r1=1.1&r2=1.2

Patches:
Index: log_firealarm.php
===================================================================
RCS file: /sources/phpgroupware/sms/bin/log_firealarm.php,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- log_firealarm.php   21 Sep 2006 13:11:25 -0000      1.1
+++ log_firealarm.php   21 Sep 2006 13:50:50 -0000      1.2
@@ -8,7 +8,7 @@
        * @internal Development of this application was funded by 
http://www.bergen.kommune.no/bbb_/ekstern/
        * @package sms
        * @subpackage sms
-       * @version $Id: log_firealarm.php,v 1.1 2006/09/21 13:11:25 sigurdne 
Exp $
+       * @version $Id: log_firealarm.php,v 1.2 2006/09/21 13:50:50 sigurdne 
Exp $
        */
 
        /**
@@ -19,10 +19,11 @@
        $entity_id  = 1;
        $cat_id = 2;
        $id_field ='securitnet_nr';
+       $dateformat= "Y-m-d"; //postgres
        
        $entity_table = 'fm_entity_' . $entity_id .'_' . $cat_id;
 
-       $this->db->query("SELECT id FROM fm_entity_attribute where entity_id = 
'$entity_id' AND cat_id = '$cat_id' AND column_name = 
$id_field",__LINE__,__FILE__);
+       $this->db->query("SELECT id FROM fm_entity_attribute where entity_id = 
'$entity_id' AND cat_id = '$cat_id' AND column_name = 
'last_alarm'",__LINE__,__FILE__);
        $this->db->next_record();
        $attrib_id = $this->db->f('id');
        
@@ -33,14 +34,17 @@
                $id     = $param[0];    
        //      $status = $status_code[$param[1]];
        
-               $this->db->query("SELECT $id_field FROM $entity_table where 
$id_field='$id'",__LINE__,__FILE__);
+               $this->db->query("SELECT id as record_id  FROM $entity_table 
WHERE $id_field='$id'",__LINE__,__FILE__);
                if($this->db->next_record())
                {       
-                       $this->db->query("UPDATE $entity_table set last_alarm 
='" . time() . "' WHERE $id_field='$id'" ,__LINE__,__FILE__);
+                       $record_id = $this->db->f('record_id');
+                       $date = date($dateformat,time());
+                       
+                       $this->db->query("UPDATE $entity_table set last_alarm 
='$date' WHERE $id_field='$id'" ,__LINE__,__FILE__);
                        $historylog     = 
CreateObject('property.historylog','entity_' . $entity_id .'_' . $cat_id);
        // temporary - fix this
                        $historylog->account = 6;
-                       $historylog->add('SO',$id,time(),False, $attrib_id);
+                       $historylog->add('SO',$record_id,$date,False, 
$attrib_id);
                        $command_output = 'success';
                }
        }




reply via email to

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