fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [7580] Property: calculate score, typecasting for NUL


From: Sigurd Nes
Subject: [Fmsystem-commits] [7580] Property: calculate score, typecasting for NULL
Date: Tue, 13 Sep 2011 08:19:33 +0000

Revision: 7580
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=7580
Author:   sigurdne
Date:     2011-09-13 08:19:32 +0000 (Tue, 13 Sep 2011)
Log Message:
-----------
Property: calculate score, typecasting for NULL

Modified Paths:
--------------
    trunk/property/inc/class.sorequest.inc.php

Modified: trunk/property/inc/class.sorequest.inc.php
===================================================================
--- trunk/property/inc/class.sorequest.inc.php  2011-09-13 06:45:36 UTC (rev 
7579)
+++ trunk/property/inc/class.sorequest.inc.php  2011-09-13 08:19:32 UTC (rev 
7580)
@@ -111,7 +111,7 @@
                        {
                                
if($GLOBALS['phpgw_info']['server']['db_type']=='pgsql' || 
$GLOBALS['phpgw_info']['server']['db_type']=='postgres')
                                {
-                                       $sql = "UPDATE fm_request SET score = 
(SELECT sum(priority_key * ( degree * probability * ( consequence )))  FROM 
fm_request_condition"
+                                       $sql = "UPDATE fm_request SET score = 
(SELECT sum(CAST(priority_key as int4) * ( CAST(degree as int4) * 
CAST(probability as int4) * ( CAST(consequence as int4) )))  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}";
 
                                        
$this->db->query($sql,__LINE__,__FILE__);
@@ -128,6 +128,7 @@
                                        $this->db->query("UPDATE fm_request SET 
score = $score WHERE id = $id",__LINE__,__FILE__);
                                }
                        }
+                       $this->db->query("UPDATE fm_request SET score = 0 WHERE 
score IS NULL",__LINE__,__FILE__);
                        $this->db->query("UPDATE fm_request SET score = score + 
{$authorities_demands} WHERE authorities_demands = 1",__LINE__,__FILE__);
                }
 




reply via email to

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