fmsystem-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Fmsystem-commits] [7762] Added field org_unit_person.


From: Torstein
Subject: [Fmsystem-commits] [7762] Added field org_unit_person.
Date: Fri, 30 Sep 2011 12:39:18 +0000

Revision: 7762
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=7762
Author:   vator
Date:     2011-09-30 12:39:17 +0000 (Fri, 30 Sep 2011)
Log Message:
-----------
Added field org_unit_person.
Added function get_synchronize_party_info().

Modified Paths:
--------------
    trunk/rental/inc/class.uiparty.inc.php

Modified: trunk/rental/inc/class.uiparty.inc.php
===================================================================
--- trunk/rental/inc/class.uiparty.inc.php      2011-09-30 12:22:34 UTC (rev 
7761)
+++ trunk/rental/inc/class.uiparty.inc.php      2011-09-30 12:39:17 UTC (rev 
7762)
@@ -23,7 +23,8 @@
                        'update_all_org_enhet_id'       => true,
                        'syncronize_party'      => true,
                        'syncronize_party_name' => true,
-                       'create_user_based_on_email' => true
+                       'create_user_based_on_email' => true,
+                       'get_synchronize_party_info' => true
        );
 
        public function __construct()
@@ -401,7 +402,7 @@
                                                $value['ajax'][] = true;
                                                $value['actions'][] = 
html_entity_decode(self::link(array('menuaction' => 
'rental.uiparty.syncronize_party', 'org_unit_id' => $value['org_unit_id'], 
'party_id' => $value['id'])));
                                                $value['labels'][] = 
lang('syncronize_party');
-                                       }
+                                       }                       
                                }
                                break;
                }
@@ -487,7 +488,7 @@
                {
                        $this->render('permission_denied.php',array('error' => 
lang('permission_denied_edit')));
                }
-
+               
                if(isset($_POST['save_party'])) // The user has pressed the 
save button
                {
                        if(isset($party)) // If a party object is created
@@ -514,6 +515,7 @@
                                $party->set_comment(phpgw::get_var('comment'));
                                
//$party->set_location_id(phpgw::get_var('location_id'));
                                
$party->set_org_enhet_id(phpgw::get_var('org_enhet_id'));
+                               
$party->set_org_unit_person(phpgw::get_var('org_unit_person'));
                                
                                
if(rental_soparty::get_instance()->store($party)) // ... and then try to store 
the object
                                {
@@ -589,6 +591,39 @@
                }
        }
        
+       public function get_synchronize_party_info()
+       {
+               if(($this->isExecutiveOfficer() || $this->isAdministrator()))
+               {
+                       $org_unit_id = phpgw::get_var("org_enhet_id");
+                                       
+                       if(isset($org_unit_id) && $org_unit_id > 0)
+                       {       
+                               $use_fellesdata = 
$config->config_data['use_fellesdata'];       
+                               if(!$use_fellesdata){
+                                       return;
+                               }
+                                                               
+                               $bofelles = rental_bofellesdata::get_instance();
+                               
+                               $org_unit_with_leader = 
$bofelles->get_result_unit_with_leader($org_unit_id);
+                               $org_department = 
$bofelles->get_department_for_org_unit($org_unit_id);
+                               
+                               $org_name = 
$org_unit_with_leader['ORG_UNIT_NAME'];
+                               $org_email = $org_unit_with_leader['ORG_EMAIL'];
+                               $unit_leader_fullname = 
$org_unit_with_leader['LEADER_FULLNAME'];
+                               
+                               $dep_org_name = $org_department['DEP_ORG_NAME'];
+                                                                       
+                               $jsonArr = array("email" => trim($org_email), 
"org_name" => trim($org_name), 
+                                                                
"unit_leader_fullname" => trim($unit_leader_fullname), "department" => 
trim($dep_org_name));
+                               
+                               return json_decode( json_encode($jsonArr) );
+                               
+                       }       
+               }
+       }       
+               
        /**
         * Function to create Portico Estate users based on email, first- and 
lastname on contract parties.
         */




reply via email to

[Prev in Thread] Current Thread [Next in Thread]