[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Fmsystem-commits] [9162]
From: |
Erik Holm-Larsen |
Subject: |
[Fmsystem-commits] [9162] |
Date: |
Tue, 17 Apr 2012 07:27:53 +0000 |
Revision: 9162
http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=9162
Author: erikhl
Date: 2012-04-17 07:27:52 +0000 (Tue, 17 Apr 2012)
Log Message:
-----------
Modified Paths:
--------------
trunk/activitycalendar/inc/class.soorganization.inc.php
Modified: trunk/activitycalendar/inc/class.soorganization.inc.php
===================================================================
--- trunk/activitycalendar/inc/class.soorganization.inc.php 2012-04-17
06:30:55 UTC (rev 9161)
+++ trunk/activitycalendar/inc/class.soorganization.inc.php 2012-04-17
07:27:52 UTC (rev 9162)
@@ -299,6 +299,7 @@
// _debug_array($new_orgs);
// _debug_array($orgmappings);
+ $this->db->transaction_begin();
//loop through activities and update organization-connection
foreach($orgmappings as $key => $value)
{
@@ -316,14 +317,24 @@
$this->set_organization_inactive($orgmapping);
//get affected stuff from booking
$alloc =
$this->get_affected_allocations($orgmapping);
- //if($alloc)
- var_dump("allocation: ".
$alloc."</br>");
+ foreach($alloc as $a)
+ {
+ var_dump($a.' flyttes fra
'.$orgmapping.' til '.$key.'</br>');
+ $this->update_affected_allocations($a,
$key);
+ }
+
$res =
$this->get_affected_reservations($orgmapping);
- //if($res)
- var_dump("reservation: ". $res."</br>");
+ foreach($res as $r)
+ {
+ var_dump($r.' flyttes fra
'.$orgmapping.' til '.$key.'</br>');
+ $this->update_affected_reservations($r,
$key);
+ }
$event =
$this->get_affected_events($orgmapping);
- //if($event)
- var_dump("event: ". $event."</br>");
+ foreach($event as $e)
+ {
+ var_dump($e.' flyttes fra
'.$orgmapping.' til '.$key.'</br>');
+ $this->update_affected_events($e, $key);
+ }
}
}
@@ -335,6 +346,8 @@
var_dump("Oppdaterer organisasjon
".$no['orgid'].','.$no['orgname'].' med ny adresse.<br/>');
$this->update_organization_with_new_info($no);
}
+
+ $this->db->transaction_commit();
}
function get_organization_name_local($org_id)
@@ -818,37 +831,55 @@
function get_affected_allocations($org_id)
{
+ $result = array();
$sql = "select id from bb_allocation where
organization_id={$org_id}";
- $this->db->query($q1, __LINE__, __FILE__);
+ $this->db->query($sql, __LINE__, __FILE__);
while($this->db->next_record()){
- $result = $this->db->f('id');
+ $result[] = $this->db->f('id');
}
return $result;
}
+ function update_affected_allocations($id, $org_id)
+ {
+ $result = $this->db->query("update bb_allocation set
organization_id={$org_id} where id={$id}", __LINE__, __FILE__);
+ }
+
function get_affected_reservations($org_id)
{
+ $result = array();
$sql = "select id from bb_completed_reservation where
organization_id={$org_id}";
- $this->db->query($q1, __LINE__, __FILE__);
+ $this->db->query($sql, __LINE__, __FILE__);
while($this->db->next_record()){
- $result = $this->db->f('id');
+ $result[] = $this->db->f('id');
}
return $result;
}
+ function update_affected_reservations($id, $org_id)
+ {
+ $result = $this->db->query("update bb_completed_reservation set
organization_id={$org_id} where id={$id}", __LINE__, __FILE__);
+ }
+
function get_affected_events($org_id)
{
+ $result = array();
$sql = "select id from bb_event where
customer_organization_id={$org_id}";
- $this->db->query($q1, __LINE__, __FILE__);
+ $this->db->query($sql, __LINE__, __FILE__);
while($this->db->next_record()){
- $result = $this->db->f('id');
+ $result[] = $this->db->f('id');
}
return $result;
}
+ function update_affected_events($id, $org_id)
+ {
+ $result = $this->db->query("update bb_event set
customer_organization_id={$org_id} where id={$id}", __LINE__, __FILE__);
+ }
+
function update($organization)
{
return false;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Fmsystem-commits] [9162],
Erik Holm-Larsen <=