[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Fmsystem-commits] [7973]
From: |
Erik Holm-Larsen |
Subject: |
[Fmsystem-commits] [7973] |
Date: |
Mon, 31 Oct 2011 09:32:53 +0000 |
Revision: 7973
http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=7973
Author: erikhl
Date: 2011-10-31 09:32:52 +0000 (Mon, 31 Oct 2011)
Log Message:
-----------
Modified Paths:
--------------
trunk/activitycalendar/inc/class.soactivity.inc.php
trunk/activitycalendar/inc/class.soorganization.inc.php
trunk/activitycalendar/inc/class.uiorganization.inc.php
trunk/activitycalendar/inc/model/class.organization.inc.php
trunk/activitycalendar/setup/phpgw_no.lang
Modified: trunk/activitycalendar/inc/class.soactivity.inc.php
===================================================================
--- trunk/activitycalendar/inc/class.soactivity.inc.php 2011-10-31 08:59:52 UTC
(rev 7972)
+++ trunk/activitycalendar/inc/class.soactivity.inc.php 2011-10-31 09:32:52 UTC
(rev 7973)
@@ -1162,4 +1162,48 @@
$result = $this->db->query($sql, __LINE__, __FILE__);
return isset($result);
}
+
+ function get_activities_for_update($org_id)
+ {
+ $activities = array();
+ $sql = "SELECT * FROM activity_activity WHERE new_org AND
organization_id={$org_id}";
+ $this->db->query($sql, __LINE__, __FILE__);
+ while ($this->db->next_record())
+ {
+ $activity = new activitycalendar_activity((int) $activity_id);
+
+
$activity->set_title($this->unmarshal($this->db->f('title'), 'string'));
+
$activity->set_organization_id($this->unmarshal($this->db->f('organization_id'),
'int'));
+
$activity->set_group_id($this->unmarshal($this->db->f('group_id'), 'int'));
+
$activity->set_district($this->unmarshal($this->db->f('district'), 'int'));
+
$activity->set_office($this->unmarshal($this->db->f('office'), 'int'));
+
$activity->set_category($this->unmarshal($this->db->f('category'), 'int'));
+
$activity->set_state($this->unmarshal($this->db->f('state'), 'int'));
+
$activity->set_target($this->unmarshal($this->db->f('target'), 'string'));
+
$activity->set_description($this->unmarshal($this->db->f('description'),
'string'));
+
$activity->set_arena($this->unmarshal($this->db->f('arena'), 'string'));
+
$activity->set_internal_arena($this->unmarshal($this->db->f('internal_arena'),
'string'));
+
$activity->set_time($this->unmarshal($this->db->f('time'), 'string'));
+
$activity->set_last_change_date($this->unmarshal($this->db->f('last_change_date'),
'int'));
+
$activity->set_special_adaptation($this->unmarshal($this->db->f('special_adaptation',
'bool')));
+
$activity->set_secret($this->unmarshal($this->db->f('secret'), 'string'));
+
$activity->set_contact_person_2_address($this->unmarshal($this->db->f('contact_person_2_address'),
'string'));
+
$activity->set_contact_person_2_zip($this->unmarshal($this->db->f('contact_person_2_zip'),
'string'));
+
$activity->set_frontend($this->unmarshal($this->db->f('frontend', 'bool')));
+
$activity->set_new_org($this->unmarshal($this->db->f('new_org', 'bool')));
+
+ if($activity->get_group_id() &&
$activity->get_group_id() > 0)
+ {
+ $contacts =
activitycalendar_sogroup::get_instance()->get_contacts($activity->get_group_id());
+ $activity->set_contact_persons($contacts);
+ $org_tmp =
activitycalendar_sogroup::get_instance()->get_orgid_from_group($activity->get_group_id());
+ $activity->set_organization_id($org_tmp);
+ }
+ else if($activity->get_organization_id() &&
$activity->get_organization_id() > 0)
+ {
+ $contacts =
activitycalendar_soorganization::get_instance()->get_contacts($activity->get_organization_id());
+ $activity->set_contact_persons($contacts);
+ }
+ }
+ }
}
Modified: trunk/activitycalendar/inc/class.soorganization.inc.php
===================================================================
--- trunk/activitycalendar/inc/class.soorganization.inc.php 2011-10-31
08:59:52 UTC (rev 7972)
+++ trunk/activitycalendar/inc/class.soorganization.inc.php 2011-10-31
09:32:52 UTC (rev 7973)
@@ -139,6 +139,7 @@
$columns[] = 'org.address';
$columns[] = 'org.district';
$columns[] = 'org.change_type';
+ $columns[] = 'org.transferred';
$columns[] = 'org.orgno AS organization_number';
$cols = implode(',',$columns);
@@ -313,9 +314,41 @@
* @param $party the party to be updated
* @return boolean true if successful, false otherwise
*/
- function update($party)
+ function update_local($organization)
{
- return false;
+ $name = $organization->get_name();
+ $orgnr = $organization->get_organization_number();
+ $homepage = $organization->get_homepage();
+ $phone = $organization->get_phone();
+ $email = $organization->get_email();
+ $description = $organization->get_description();
+ $street = $organization->get_address();
+ $district = $organization->get_district();
+ $change_type = $organization->get_change_type();
+ $transferred = $organization->get_transferred()?true:false;
+
+ $values[] = "NAME='{$name}'";
+ $values[] = "HOMEPAGE='{$homepage}'";
+ $values[] = "PHONE='{$phone}'";
+ $values[] = "EMAIL='{$email}'";
+ $values[] = "DESCRIPTION='{$description}'";
+ $values[] = "ADDRESS='{$street}'";
+ $values[] = "ORGNO='{$orgnr}'";
+ $values[] = "DISTRICT='{$district}'";
+ $values[] = "CHANGE_TYPE='{$change_type}'";
+ $values[] = "TRANSFERRED='{$transferred}'";
+ $vals = implode(',',$values);
+
+ $sql = "UPDATE activity_organization SET {$vals} WHERE
ID={$organization->get_id()}";
+ $result = $this->db->query($sql, __LINE__, __FILE__);
+ if(isset($result))
+ {
+ return true;
+ }
+ else
+ {
+ return false;
+ }
}
public function get_id_field_name($extended_info = false)
@@ -351,6 +384,7 @@
$organization->set_district($this->unmarshal($this->db->f('district'),
'string'));
$organization->set_description($this->unmarshal($this->db->f('description'),
'string'));
$organization->set_change_type($this->unmarshal($this->db->f('change_type'),
'string'));
+
$organization->set_transferred($this->unmarshal($this->db->f('trnasferred'),
'bool'));
$organization->set_show_in_portal($this->unmarshal($this->db->f('show_in_portal'),
'int'));
}
return $organization;
@@ -466,5 +500,10 @@
return 0;
}
}
+
+ function update($organization)
+ {
+ return false;
+ }
}
?>
Modified: trunk/activitycalendar/inc/class.uiorganization.inc.php
===================================================================
--- trunk/activitycalendar/inc/class.uiorganization.inc.php 2011-10-31
08:59:52 UTC (rev 7972)
+++ trunk/activitycalendar/inc/class.uiorganization.inc.php 2011-10-31
09:32:52 UTC (rev 7973)
@@ -167,7 +167,7 @@
$org_info['homepage'] = $homepage;
$org_info['phone'] = $phone;
$org_info['email'] = $email;
- $org_info['description'] = $description;
+ $org_info['description'] = $desc;
$org_info['street'] = $address_array[0];
$org_info['zip'] = $address_array[1];
$org_info['activity_id'] = '';
@@ -182,16 +182,30 @@
$contact1['name'] = $contact1_name;
$contact1['phone'] = $contact1_phone;
$contact1['mail'] = $contact1_email;
- $contact1['org_id'] =
$this->decode($new_org_id);
-
$so_contact->add_contact_person_org($contact1);
+ $contact1['org_id'] = $new_org_id;
+
$so_activity->add_contact_person_org($contact1);
$contact2 = array();
$contact2['name'] = $contact2_name;
$contact2['phone'] = $contact2_phone;
$contact2['mail'] = $contact_mail_2;
- $contact2['org_id'] =
$this->decode($new_org_id);
-
$so_contact->add_contact_person_org($contact2);
+ $contact2['org_id'] = $new_org_id;
+
$so_activity->add_contact_person_org($contact2);
$message = lang('messages_saved_form');
+
+ //get affected activities and update
with new org id
+ $update_activities =
$so_activity->get_activities_for_update($new_org_id);
+ foreach($update_activities as $act)
+ {
+
$act->set_organization_id($new_org_id);
+ $act->set_new_org(false);
+ $so_activity->store($act);
+ }
+
+ //set local organization as stored
+ $org->set_change_type("added");
+ $org->set_transferred(true);
+ $so->update_local($org);
}
else
{
Modified: trunk/activitycalendar/inc/model/class.organization.inc.php
===================================================================
--- trunk/activitycalendar/inc/model/class.organization.inc.php 2011-10-31
08:59:52 UTC (rev 7972)
+++ trunk/activitycalendar/inc/model/class.organization.inc.php 2011-10-31
09:32:52 UTC (rev 7973)
@@ -16,6 +16,7 @@
protected $phone;
protected $address;
protected $change_type;
+ protected $transferred;
/**
* Constructor. Takes an optional ID. If a organization is
created from outside
@@ -105,6 +106,13 @@
public function get_district() { return $this->district; }
+ public function set_transferred($transferred)
+ {
+ $this->transferred = $transferred;
+ }
+
+ public function get_transferred() { return $this->transferred; }
+
public function serialize()
{
$so_org =
activitycalendar_soorganization::get_instance();
Modified: trunk/activitycalendar/setup/phpgw_no.lang
===================================================================
--- trunk/activitycalendar/setup/phpgw_no.lang 2011-10-31 08:59:52 UTC (rev
7972)
+++ trunk/activitycalendar/setup/phpgw_no.lang 2011-10-31 09:32:52 UTC (rev
7973)
@@ -391,4 +391,5 @@
contact_person_2_zip activitycalendar no Poststed for
kulturkontoret
active_arena activitycalendar no Aktiv
inactive_arena activitycalendar no Inaktiv
-change_type activitycalendar no Endringstype
\ No newline at end of file
+change_type activitycalendar no Endringstype
+added activitycalendar no Lagt til i organisasjonsregisteret
\ No newline at end of file
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Fmsystem-commits] [7973],
Erik Holm-Larsen <=