[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Fmsystem-commits] [13862] property: get correct responsibility name
From: |
Sigurd Nes |
Subject: |
[Fmsystem-commits] [13862] property: get correct responsibility name |
Date: |
Tue, 08 Sep 2015 14:13:40 +0000 |
Revision: 13862
http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=13862
Author: sigurdne
Date: 2015-09-08 14:13:39 +0000 (Tue, 08 Sep 2015)
Log Message:
-----------
property: get correct responsibility name
Modified Paths:
--------------
trunk/property/inc/class.soresponsible.inc.php
trunk/property/inc/class.uilocation.inc.php
Modified: trunk/property/inc/class.soresponsible.inc.php
===================================================================
--- trunk/property/inc/class.soresponsible.inc.php 2015-09-08 00:16:26 UTC
(rev 13861)
+++ trunk/property/inc/class.soresponsible.inc.php 2015-09-08 14:13:39 UTC
(rev 13862)
@@ -440,11 +440,11 @@
/**
* get the responsibility name
*
- * @param type $id
- * @return string name
+ * @param type $id responsibility id
+ * @return string responsibility name
*/
public function get_responsibility_name($id)
- {
+ {
static $names = array();
$i = (int) $id;
@@ -452,17 +452,42 @@
{
return $names[$i];
}
-
$sql = "SELECT * FROM fm_responsibility WHERE id=
{$id}";
$this->db->query($sql, __LINE__, __FILE__);
- $this->db->next_record();
+ $this->db->next_record();
$name = $this->db->f('name', true);
$names[$i] = $name;
return $name;
}
/**
+ * get the responsibility name from role
+ *
+ * @param type $id role id
+ * @return string responsibility name
+ */
+ public function get_responsibility_name_from_role($id)
+ {
+ static $names = array();
+ $i = (int) $id;
+
+ if ($names[$i])
+ {
+ return $names[$i];
+ }
+
+ $sql = "SELECT fm_responsibility.name FROM
fm_responsibility"
+ . " {$this->join} fm_responsibility_role ON
fm_responsibility.id = fm_responsibility_role.responsibility_id"
+ . " WHERE fm_responsibility_role.id= {$id}";
+ $this->db->query($sql, __LINE__, __FILE__);
+ $this->db->next_record();
+ $name = $this->db->f('name', true);
+ $names[$i] = $name;
+ return $name;
+ }
+
+ /**
* Read single responsibility type
*
* @param integer $id ID of responsibility type
Modified: trunk/property/inc/class.uilocation.inc.php
===================================================================
--- trunk/property/inc/class.uilocation.inc.php 2015-09-08 00:16:26 UTC (rev
13861)
+++ trunk/property/inc/class.uilocation.inc.php 2015-09-08 14:13:39 UTC (rev
13862)
@@ -1255,7 +1255,7 @@
foreach($values_combo_box[4] as &$_role)
{
- $_role['name'] .= ':: ' .
execMethod('property.soresponsible.get_responsibility_name',$_role['id']);
+ $_role['name'] .= ':: ' .
execMethod('property.soresponsible.get_responsibility_name_from_role',$_role['id']);
}
$default_value = array
('id'=>'','name'=>lang('no role'));
array_unshift
($values_combo_box[4],$default_value);
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Fmsystem-commits] [13862] property: get correct responsibility name,
Sigurd Nes <=