fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [7017] Checking if fellesdata is set to true


From: lars.nestas
Subject: [Fmsystem-commits] [7017] Checking if fellesdata is set to true
Date: Thu, 17 Feb 2011 08:37:43 +0000

Revision: 7017
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=7017
Author:   "lars.nestas"
Date:     2011-02-17 08:37:43 +0000 (Thu, 17 Feb 2011)
Log Message:
-----------
Checking if fellesdata is set to true

Modified Paths:
--------------
    trunk/frontend/inc/class.uicontract.inc.php
    trunk/frontend/inc/class.uidelegates.inc.php
    trunk/frontend/inc/class.uifrontend.inc.php
    trunk/rental/inc/class.uidelegate.inc.php
    trunk/rental/inc/class.uiparty.inc.php
    trunk/rental/inc/class.uiresultunit.inc.php
    trunk/rental/inc/plugins/fellesdata/party.edit.php
    trunk/rental/setup/phpgw_no.lang

Modified: trunk/frontend/inc/class.uicontract.inc.php
===================================================================
--- trunk/frontend/inc/class.uicontract.inc.php 2011-02-17 08:32:37 UTC (rev 
7016)
+++ trunk/frontend/inc/class.uicontract.inc.php 2011-02-17 08:37:43 UTC (rev 
7017)
@@ -55,32 +55,38 @@
                {
                        $contract_id = phpgw::get_var('contract_id');
                        $contract_message = phpgw::get_var('contract_message');
-                       
-                       $user_data = 
frontend_bofellesdata::get_instance()->get_user($GLOBALS['phpgw_info']['user']['account_lid']);
-                       
-                       if($user_data['email'])
-                       {
-                               if(isset($contract_message) && 
$contract_message != '')
+                       $use_fellesdata = 
$config->config_data['use_fellesdata'];
+                       if($use_fellesdata){
+                               $user_data = 
frontend_bofellesdata::get_instance()->get_user($GLOBALS['phpgw_info']['user']['account_lid']);
+                                       
+                               if($user_data['email'])
                                {
-                                       $from_address = $user_data['email'];
-                                       $result = 
frontend_borental::send_contract_message($contract_id, $contract_message, 
$from_address);
-                                       if($result)
+                                       if(isset($contract_message) && 
$contract_message != '')
                                        {
-                                               $msglog['message'] = 
lang('message_sent');
+                                               $from_address = 
$user_data['email'];
+                                               $result = 
frontend_borental::send_contract_message($contract_id, $contract_message, 
$from_address);
+                                               if($result)
+                                               {
+                                                       $msglog['message'] = 
lang('message_sent');
+                                               }
+                                               else
+                                               {
+                                                       $msglog['error'] = 
lang('message_not_sent');
+                                               }
                                        }
                                        else
                                        {
-                                               $msglog['error'] = 
lang('message_not_sent');
+                                               $msglog['error'] = 
lang('message_empty');
                                        }
                                }
                                else
                                {
-                                       $msglog['error'] = 
lang('message_empty');
+                                       $msglog['error'] = 
lang('user_not_in_fellesdata');
                                }
                        }
                        else
                        {
-                               $msglog['error'] = 
lang('user_not_in_fellesdata');
+                               $msglog['error'] = 
lang('fellesdata_not_in_use');
                        }
                }
                

Modified: trunk/frontend/inc/class.uidelegates.inc.php
===================================================================
--- trunk/frontend/inc/class.uidelegates.inc.php        2011-02-17 08:32:37 UTC 
(rev 7016)
+++ trunk/frontend/inc/class.uidelegates.inc.php        2011-02-17 08:37:43 UTC 
(rev 7017)
@@ -18,7 +18,8 @@
                
 
                public function index()
-               {                       
+               {               
+                       $use_fellesdata = 
$config->config_data['use_fellesdata'];       
                        if(isset($_POST['search']))
                        {
                                $username = phpgw::get_var('username');
@@ -40,11 +41,14 @@
                                        }
                                        else
                                        {
-                                               $fellesdata_user = 
frontend_bofellesdata::get_instance()->get_user($username);
-                                               if($fellesdata_user)
-                                               {
-                                                       $search = 
$fellesdata_user;
-                                                       $msglog['message'][] = 
array('msg' => lang('user_found_in_Fellesdata'));
+                                               if($use_fellesdata){
+                                                       $fellesdata_user = 
frontend_bofellesdata::get_instance()->get_user($username);
+                                               
+                                                       if($fellesdata_user)
+                                                       {
+                                                               $search = 
$fellesdata_user;
+                                                               
$msglog['message'][] = array('msg' => lang('user_found_in_Fellesdata'));
+                                                       }
                                                }
                                                else
                                                {
@@ -56,33 +60,34 @@
                        else if(isset($_POST['add']))
                        {
                                $account_id = phpgw::get_var('account_id');
-                               
-                               $org_units = 
frontend_bofellesdata::get_instance()->get_result_units($GLOBALS['phpgw_info']['user']['account_lid']);
-                               
-                               //Parameter to delegate access to only a single 
organisational unit
-                               $org_unit_id = 
$this->header_state['selected_org_unit'];
-                               $success = true;
-                               
-                               foreach($org_units as $org_unit)
-                               {
-                                       if($org_unit_id == 'all' || 
$org_unit['ORG_UNIT_ID'] == $org_unit_id)
+                               $success = false;
+                               if($use_fellesdata){
+                                       $org_units = 
frontend_bofellesdata::get_instance()->get_result_units($GLOBALS['phpgw_info']['user']['account_lid']);
+                                       
+                                       //Parameter to delegate access to only 
a single organisational unit
+                                       $org_unit_id = 
$this->header_state['selected_org_unit'];
+                                       $success = true;
+                                       
+                                       foreach($org_units as $org_unit)
                                        {
-                                               //$curr_success = true;
-                                               $res = 
$this->add_delegate($account_id,$org_unit['ORG_UNIT_ID'],$org_unit['ORG_NAME']);
-                                               if($res)
+                                               if($org_unit_id == 'all' || 
$org_unit['ORG_UNIT_ID'] == $org_unit_id)
                                                {
-                                                       //$mail_contents[] = 
$res;
-                                                       $org_unit_names[] = 
$org_unit['ORG_NAME'];
+                                                       //$curr_success = true;
+                                                       $res = 
$this->add_delegate($account_id,$org_unit['ORG_UNIT_ID'],$org_unit['ORG_NAME']);
+                                                       if($res)
+                                                       {
+                                                               
//$mail_contents[] = $res;
+                                                               
$org_unit_names[] = $org_unit['ORG_NAME'];
+                                                       }
+                                                       else
+                                                       {
+                                                               
$msglog['error'][] = array('msg' => 
lang('error_delegating_unit',$org_unit['ORG_NAME']));
+                                                       }
+                                                       
+                                                       $success = $success && 
$res;
                                                }
-                                               else
-                                               {
-                                                       $msglog['error'][] = 
array('msg' => lang('error_delegating_unit',$org_unit['ORG_NAME']));
-                                               }
-                                               
-                                               $success = $success && $res;
                                        }
                                }
-                               
                                if($success)
                                {
                                        //Retrieve the usernames
@@ -199,6 +204,11 @@
                
                public function add_delegate(int $account_id, $org_unit_id, 
$org_name)
                {
+                       $use_fellesdata = 
$config->config_data['use_fellesdata'];
+                       if(!$use_fellesdata)
+                       {
+                               return;
+                       }
                        if(!isset($account_id) || $account_id == '')
                        {
                                //User is only registered in Fellesdata

Modified: trunk/frontend/inc/class.uifrontend.inc.php
===================================================================
--- trunk/frontend/inc/class.uifrontend.inc.php 2011-02-17 08:32:37 UTC (rev 
7016)
+++ trunk/frontend/inc/class.uifrontend.inc.php 2011-02-17 08:37:43 UTC (rev 
7017)
@@ -125,32 +125,33 @@
                        else if(isset($param_only_org_unit)) 
                        {
                                //TODO: check permissions
-                               
-                               $name_and_result_number = 
frontend_bofellesdata::get_instance()->get_organisational_unit_info($param_only_org_unit);
-                               
-                               //Specify unit
-                               $org_unit_ids = array(
-                                       array(
-                                               "ORG_UNIT_ID" => 
$param_only_org_unit,
-                                               "ORG_NAME" => 
$name_and_result_number['UNIT_NAME'],
-                                               "UNIT_ID" => 
$name_and_result_number['UNIT_NUMBER']
-                                       )
-                               );
-                                                               
-                               //Update header state
-                               $this->header_state['org_unit'] = $org_unit_ids;
-                               $this->header_state['number_of_org_units'] = 
'1';
-                               //$this->header_state['selected_org_unit'] = 
$name_and_result_number['UNIT_NUMBER'];
-                               $this->header_state['selected_org_unit'] = 
$param_only_org_unit;
-                               
-                               //Update locations
-                               $property_locations = 
frontend_borental::get_property_locations($org_unit_ids);
-                               $property_locations_update = true;
-                               
-                               $noframework = false; // In regular frames
-                               phpgwapi_cache::session_set('frontend', 
'noframework', $noframework); // Store mode on session
-                               
$GLOBALS['phpgw_info']['flags']['menu_selection'] = "frontend::{$selected}";
-                               $this->insert_links_on_header_state();
+                               if($use_fellesdata){
+                                       $name_and_result_number = 
frontend_bofellesdata::get_instance()->get_organisational_unit_info($param_only_org_unit);
+                                                                       
+                                       //Specify unit
+                                       $org_unit_ids = array(
+                                               array(
+                                                       "ORG_UNIT_ID" => 
$param_only_org_unit,
+                                                       "ORG_NAME" => 
$name_and_result_number['UNIT_NAME'],
+                                                       "UNIT_ID" => 
$name_and_result_number['UNIT_NUMBER']
+                                               )
+                                       );
+                                                                       
+                                       //Update header state
+                                       $this->header_state['org_unit'] = 
$org_unit_ids;
+                                       
$this->header_state['number_of_org_units'] = '1';
+                                       
//$this->header_state['selected_org_unit'] = 
$name_and_result_number['UNIT_NUMBER'];
+                                       
$this->header_state['selected_org_unit'] = $param_only_org_unit;
+                                       
+                                       //Update locations
+                                       $property_locations = 
frontend_borental::get_property_locations($org_unit_ids);
+                                       $property_locations_update = true;
+                                       
+                                       $noframework = false; // In regular 
frames
+                                       phpgwapi_cache::session_set('frontend', 
'noframework', $noframework); // Store mode on session
+                                       
$GLOBALS['phpgw_info']['flags']['menu_selection'] = "frontend::{$selected}";
+                                       $this->insert_links_on_header_state();
+                               }
                        } 
                        /* No state, first visit after login, or refresh 
request*/
                        else if(!isset($this->header_state) || isset($refresh) 
|| !isset($this->header_state['locations']))

Modified: trunk/rental/inc/class.uidelegate.inc.php
===================================================================
--- trunk/rental/inc/class.uidelegate.inc.php   2011-02-17 08:32:37 UTC (rev 
7016)
+++ trunk/rental/inc/class.uidelegate.inc.php   2011-02-17 08:37:43 UTC (rev 
7017)
@@ -49,8 +49,9 @@
                }
                
                public function add_actions(&$value, $key, $params)
-               {
-                       if(($this->isExecutiveOfficer() || 
$this->isAdministrator()))
+               {                       
+                       $use_fellesdata = 
$config->config_data['use_fellesdata'];
+                       if(($this->isExecutiveOfficer() || 
$this->isAdministrator()) && $use_fellesdata)
                        {
                                $unit_id = $params[0];
                                

Modified: trunk/rental/inc/class.uiparty.inc.php
===================================================================
--- trunk/rental/inc/class.uiparty.inc.php      2011-02-17 08:32:37 UTC (rev 
7016)
+++ trunk/rental/inc/class.uiparty.inc.php      2011-02-17 08:37:43 UTC (rev 
7017)
@@ -76,6 +76,7 @@
                
                //Retrieve the type of query and perform type specific logic
                $type = phpgw::get_var('type');
+               $use_fellesdata = $config->config_data['use_fellesdata'];       
                switch($type)
                {
                        case 'included_parties': // ... get all parties 
incolved in the contract
@@ -89,7 +90,10 @@
                        case 'sync_parties_identifier':
                        case 'sync_parties_org_unit':
                                $filters = array('sync' => $type, 'party_type' 
=> phpgw::get_var('party_type'), 'active' => phpgw::get_var('active'));
-                               $bofelles = rental_bofellesdata::get_instance();
+                               if($use_fellesdata)
+                               {
+                                       $bofelles = 
rental_bofellesdata::get_instance();
+                               }
                                break;
                        default: // ... get all parties of a given type
                                phpgwapi_cache::session_set('rental', 
'party_query', $search_for);
@@ -103,39 +107,42 @@
                $result_objects = 
rental_soparty::get_instance()->get($start_index, $num_of_objects, $sort_field, 
$sort_ascending, $search_for, $search_type, $filters);
                $result_count = 
rental_soparty::get_instance()->get_count($search_for, $search_type, $filters);
                
+               
                // Create an empty row set
                $rows = array();
                foreach ($result_objects as $party) {
                        if(isset($party))
                        {
                                $serialized = $party->serialize($contract);
-                               $sync_data = $party->get_sync_data();
-                               if($type == 'sync_parties')
-                               {
-                                       $unit_name_and_id = 
$bofelles->responsibility_id_exist($sync_data['responsibility_id']);
-                               }
-                               else if($type == 'sync_parties_res_unit')
-                               {
-                                       $unit_name_and_id = 
$bofelles->result_unit_exist($sync_data['result_unit_number']);
-                               }
-                               else if($type == 'sync_parties_identifier')
-                               {
-                                       $unit_name_and_id = 
$bofelles->result_unit_exist($party->get_identifier());
-                               }
-                               else if($type == 'sync_parties_org_unit')
-                               {
-                                       $unit_name_and_id = 
$bofelles->org_unit_exist($sync_data['org_enhet_id']);
-                               }
-                               
-                               if(isset($unit_name_and_id))
-                               {
-                                       $unit_id = $unit_name_and_id['UNIT_ID'];
-                                       $unit_name = 
$unit_name_and_id['UNIT_NAME'];
-                                       if(isset($unit_id) && 
is_numeric($unit_id))
+                               if($use_fellesdata){
+                                       $sync_data = $party->get_sync_data();
+                                       if($type == 'sync_parties')
                                        {
-                                               $serialized['org_unit_name'] =  
isset($unit_name) ? $unit_name : lang('no_name');
-                                               $serialized['org_unit_id'] = 
$unit_id;
+                                               $unit_name_and_id = 
$bofelles->responsibility_id_exist($sync_data['responsibility_id']);
                                        }
+                                       else if($type == 
'sync_parties_res_unit')
+                                       {
+                                               $unit_name_and_id = 
$bofelles->result_unit_exist($sync_data['result_unit_number']);
+                                       }
+                                       else if($type == 
'sync_parties_identifier')
+                                       {
+                                               $unit_name_and_id = 
$bofelles->result_unit_exist($party->get_identifier());
+                                       }
+                                       else if($type == 
'sync_parties_org_unit')
+                                       {
+                                               $unit_name_and_id = 
$bofelles->org_unit_exist($sync_data['org_enhet_id']);
+                                       }
+                                       
+                                       if(isset($unit_name_and_id))
+                                       {
+                                               $unit_id = 
$unit_name_and_id['UNIT_ID'];
+                                               $unit_name = 
$unit_name_and_id['UNIT_NAME'];
+                                               if(isset($unit_id) && 
is_numeric($unit_id))
+                                               {
+                                                       
$serialized['org_unit_name'] =  isset($unit_name) ? $unit_name : 
lang('no_name');
+                                                       
$serialized['org_unit_id'] = $unit_id;
+                                               }
+                                       }
                                }
                                $rows[] = $serialized;
                        }
@@ -171,6 +178,10 @@
         */
        public function update_all_org_enhet_id()
        {
+               $use_fellesdata = $config->config_data['use_fellesdata'];       
+               if(!$use_fellesdata){
+                       return;
+               }
                $bofelles = rental_bofellesdata::get_instance();
                
                $parties = rental_soparty::get_instance()->get();

Modified: trunk/rental/inc/class.uiresultunit.inc.php
===================================================================
--- trunk/rental/inc/class.uiresultunit.inc.php 2011-02-17 08:32:37 UTC (rev 
7016)
+++ trunk/rental/inc/class.uiresultunit.inc.php 2011-02-17 08:37:43 UTC (rev 
7017)
@@ -24,6 +24,7 @@
                
                public function query()
                {
+                       $use_fellesdata = 
$config->config_data['use_fellesdata'];
                        
if($GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'] > 0)
                        {
                                $user_rows_per_page = 
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
@@ -93,10 +94,11 @@
                public function edit(){
                        
                        $GLOBALS['phpgw_info']['flags']['app_header'] .= 
'::'.lang('edit');
+                       $use_fellesdata = 
$config->config_data['use_fellesdata'];
                        
                        $unit_id = (int)phpgw::get_var('id');
                        
-                       if (isset($unit_id) && $unit_id > 0) {
+                       if (isset($unit_id) && $unit_id > 0 && $use_fellesdata) 
{
                                
                                $msglog['error']['msg'] = 
phpgw::get_var('error');
                                $msglog['message']['msg'] = 
phpgw::get_var('message');
@@ -172,7 +174,8 @@
                
                public function add_delegate(int $account_id, $org_unit_id, 
$org_name)
                {
-                       if(!isset($account_id) || $account_id == '')
+                       $use_fellesdata = 
$config->config_data['use_fellesdata'];
+                       if(!isset($account_id) || $account_id == '' && 
$use_fellesdata)
                        {
                                //User is only registered in Fellesdata
                                $username = phpgw::get_var('username'); 
@@ -199,7 +202,7 @@
                                $org_name_string = $org_name;
 
                                //If the usernames are set retrieve account 
data from Fellesdata
-                               if(isset($user_name) && $user_name != '' && 
$owner_name && $owner_name != '')
+                               if(isset($user_name) && $user_name != '' && 
$owner_name && $owner_name != '' && $use_fellesdata)
                                {
                                        $fellesdata_user = 
frontend_bofellesdata::get_instance()->get_user($user_name);
                                        $fellesdata_owner = 
frontend_bofellesdata::get_instance()->get_user($owner_name);

Modified: trunk/rental/inc/plugins/fellesdata/party.edit.php
===================================================================
--- trunk/rental/inc/plugins/fellesdata/party.edit.php  2011-02-17 08:32:37 UTC 
(rev 7016)
+++ trunk/rental/inc/plugins/fellesdata/party.edit.php  2011-02-17 08:37:43 UTC 
(rev 7017)
@@ -9,6 +9,7 @@
                        <select name="org_enhet_id">
                                <option value=""><?php echo 
lang('no_party_location') ?></option>
                <?php
+                       
                        $result_units = 
rental_bofellesdata::get_instance()->get_result_units();
                        $party_org_enhet_id = $party->get_org_enhet_id();
                        foreach ($result_units as $result_unit)

Modified: trunk/rental/setup/phpgw_no.lang
===================================================================
--- trunk/rental/setup/phpgw_no.lang    2011-02-17 08:32:37 UTC (rev 7016)
+++ trunk/rental/setup/phpgw_no.lang    2011-02-17 08:37:43 UTC (rev 7017)
@@ -213,6 +213,7 @@
 facilit_import rental  no      Import fra Facilit
 failed_removing_delegate       rental  no      Det oppstod en feil under 
sletting av delegaten.
 fax    rental  no      Faks
+fellesdata_not_in_use  rental  no      Fellesdata er ikke i bruk
 field_of_responsibility        rental  no      Ansvarsområde
 filters        rental  no      Filtre
 Finish rental  no      Avslutt
@@ -555,6 +556,7 @@
 unable_to_connect_to_database  rental  no      Problemer med å koble til 
databasen.
 unknown_user   rental  no      Personen finnes ikke.
 user_found_in_Fellesdata       rental  no      Personen finnes i Fellesdata.
+user_not_in_fellesdata rental  no      Personen finnes ikke i Fellesdata.
 user_found_in_PE       rental  no      Personen er bruker av dette systemet.
 warning_billing_date_between   rental  no      Fakturastart må være innenfor 
kontraktens datoer!
 warning_due_date_between       rental  no      Opsjonsfrist må være innenfor 
kontraktens datoer!




reply via email to

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