[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Fmsystem-commits] [7887] rental: Get id/name for org unit from fellesda
From: |
Sigurd Nes |
Subject: |
[Fmsystem-commits] [7887] rental: Get id/name for org unit from fellesdata |
Date: |
Mon, 17 Oct 2011 13:46:35 +0000 |
Revision: 7887
http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=7887
Author: sigurdne
Date: 2011-10-17 13:46:34 +0000 (Mon, 17 Oct 2011)
Log Message:
-----------
rental: Get id/name for org unit from fellesdata
Modified Paths:
--------------
trunk/rental/inc/class.bofellesdata.inc.php
Modified: trunk/rental/inc/class.bofellesdata.inc.php
===================================================================
--- trunk/rental/inc/class.bofellesdata.inc.php 2011-10-17 13:45:53 UTC (rev
7886)
+++ trunk/rental/inc/class.bofellesdata.inc.php 2011-10-17 13:46:34 UTC (rev
7887)
@@ -186,6 +186,38 @@
}
return $values;
}
+
+
+ /**
+ * Get id/name for org unit
+ * @param integer $level level in organization hierarchy
+ *
+ * @return array values prepared for standardized select/filter
+ */
+ public function get_org_units($level = 1)
+ {
+ $this->log(__class__, __function__);
+
+ $level = (int) $level;
+ $columns = "V_ORG_ENHET.ORG_ENHET_ID,
V_ORG_ENHET.ORG_NAVN";
+ $tables = "V_ORG_ENHET";
+ $sql = "SELECT {$columns} FROM {$tables} WHERE
V_ORG_ENHET.ORG_NIVAA = {$level} ORDER BY V_ORG_ENHET.ORG_NAVN ASC";
+ $db = $this->get_db();
+ $db->query($sql,__LINE__,__FILE__);
+
+ $values = array();
+ while($db->next_record())
+ {
+ $values[] = array
+ (
+ 'id' => (int)$db->f('ORG_ENHET_ID'),
+ 'name' => $db->f('ORG_NAVN'),
+ );
+ }
+
+ return $values;
+ }
+
public function get_result_unit_with_leader($org_unit_id)
{
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Fmsystem-commits] [7887] rental: Get id/name for org unit from fellesdata,
Sigurd Nes <=