[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Fmsystem-commits] [15023] property: item id at location
From: |
sigurdne |
Subject: |
[Fmsystem-commits] [15023] property: item id at location |
Date: |
Fri, 13 May 2016 11:43:44 +0000 (UTC) |
Revision: 15023
http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=15023
Author: sigurdne
Date: 2016-05-13 11:43:43 +0000 (Fri, 13 May 2016)
Log Message:
-----------
property: item id at location
Modified Paths:
--------------
trunk/property/inc/class.solocation.inc.php
Modified: trunk/property/inc/class.solocation.inc.php
===================================================================
--- trunk/property/inc/class.solocation.inc.php 2016-05-13 11:43:40 UTC (rev
15022)
+++ trunk/property/inc/class.solocation.inc.php 2016-05-13 11:43:43 UTC (rev
15023)
@@ -1335,6 +1335,9 @@
$this->db->query($sql, __LINE__, __FILE__);
$this->update_location_name($location['location_code']);
+ $id = $this->get_item_id( $location['location_code'] );
+ $this->db->query("UPDATE fm_location{$type_id} SET id =
{$id} WHERE location_code = '{$location['location_code']}'", __LINE__,
__FILE__);
+
$this->db->transaction_commit();
$receipt['message'][] = array('msg' => lang('Location
%1 has been saved', $location['location_code']));
@@ -1563,9 +1566,9 @@
}
}
- foreach ($locations as $level => $location_at_leve)
+ foreach ($locations as $level => $location_at_level)
{
- foreach ($location_at_leve as $location)
+ foreach ($location_at_level as $location)
{
$sql = "UPDATE fm_location{$level} SET
location_code = '{$location['new_values']['location_code']}'
{$location['condition']}";
$this->db->query($sql, __LINE__,
__FILE__);
@@ -1594,6 +1597,7 @@
$receipt['message'][] = array('msg' =>
lang('location %1 added at level %2', $location['location_code'],
$location['level']));
}
+ unset($location);
// Check ACL-location - currently only level 1
$GLOBALS['phpgw']->config->read();
@@ -1635,6 +1639,26 @@
$this->update_location_name($location_code);
}
+
+ $locations = array();
+ for ($i = 1; $i < ($levels + 1); $i++)
+ {
+ $this->db->query("SELECT
fm_location{$i}.location_code, fm_locations.id FROM fm_location{$i}
{$this->join} fm_locations ON fm_location{$i}.location_code =
fm_locations.location_code WHERE fm_location{$i}.id IS NULL");
+ while ($this->db->next_record())
+ {
+ $locations[] = array(
+ 'level' => $i,
+ 'location_code' =>
$this->db->f('location_code'),
+ 'id' => (int)$this->db->f('id')
+ );
+ }
+ }
+
+ foreach ($locations as $location)
+ {
+ $this->db->query("UPDATE
fm_location{$location['level']} SET id = {$location['id']} WHERE location_code
= '{$location['location_code']}'");
+ }
+
if (!$this->global_lock)
{
if ($this->db->transaction_commit())
@@ -1919,7 +1943,7 @@
{
$this->db->query("SELECT id FROM fm_locations WHERE
location_code='{$location_code}'", __LINE__, __FILE__);
$this->db->next_record();
- return $this->db->f('id');
+ return (int)$this->db->f('id');
}
public function get_location_code( $id )
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Fmsystem-commits] [15023] property: item id at location,
sigurdne <=