fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [6512] merge 6509:6511 from trunk


From: Sigurd Nes
Subject: [Fmsystem-commits] [6512] merge 6509:6511 from trunk
Date: Mon, 25 Oct 2010 11:54:42 +0000

Revision: 6512
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=6512
Author:   sigurdne
Date:     2010-10-25 11:54:42 +0000 (Mon, 25 Oct 2010)
Log Message:
-----------
merge 6509:6511 from trunk

Modified Paths:
--------------
    branches/Version-1_0-branch/booking/inc/class.uievent.inc.php
    branches/Version-1_0-branch/rental/inc/class.uiparty.inc.php

Property Changed:
----------------
    branches/Version-1_0-branch/


Property changes on: branches/Version-1_0-branch
___________________________________________________________________
Modified: svn:mergeinfo
   - 
/trunk:6439-6441,6443,6445-6447,6449-6464,6466-6468,6470-6474,6476-6477,6479-6480,6483-6488,6490-6491,6493-6494,6496-6501,6503-6504,6506,6508
   + 
/trunk:6439-6441,6443,6445-6447,6449-6464,6466-6468,6470-6474,6476-6477,6479-6480,6483-6488,6490-6491,6493-6494,6496-6501,6503-6504,6506,6508,6510-6511

Modified: branches/Version-1_0-branch/booking/inc/class.uievent.inc.php
===================================================================
--- branches/Version-1_0-branch/booking/inc/class.uievent.inc.php       
2010-10-25 10:57:22 UTC (rev 6511)
+++ branches/Version-1_0-branch/booking/inc/class.uievent.inc.php       
2010-10-25 11:54:42 UTC (rev 6512)
@@ -466,12 +466,13 @@
                                        }
                                } elseif ($_POST['customer_identifier_type'] == 
'ssn') {
                                        $event['customer_identifier_type'] = 
'ssn';
-                                       $event['customer_ssn'] = 
$organization['customer_ssn'];
+                                       $event['customer_ssn'] = 
$_POST['customer_ssn'];
                                        
                                } elseif ($_POST['customer_identifier_type'] == 
'organization_number') {
                                        $event['customer_identifier_type'] = 
'organization_number';
-                                       $event['customer_organization_number'] 
= $organization['customer_organization_number'];
+                                       $event['customer_organization_number'] 
= $_POST['customer_organization_number'];
                                }
+
                                if(!$errors['event'] and 
!$errors['resource_number'] and !$errors['organization_number'])
                                {
                                        if (phpgw::get_var('mail', 'POST'))

Modified: branches/Version-1_0-branch/rental/inc/class.uiparty.inc.php
===================================================================
--- branches/Version-1_0-branch/rental/inc/class.uiparty.inc.php        
2010-10-25 10:57:22 UTC (rev 6511)
+++ branches/Version-1_0-branch/rental/inc/class.uiparty.inc.php        
2010-10-25 11:54:42 UTC (rev 6512)
@@ -20,6 +20,7 @@
                        'download'                      => true,
                        'download_agresso'      => true,
                        'sync'                          => true,
+                       'update_all_org_enhet_id'       => true,
                        'syncronize_party'      => true
        );
 
@@ -160,7 +161,96 @@
                
                return $this->yui_results($party_data, 'total_records', 
'results');
        }
+       
+       /*
+        * One time job for updating the parties with no org_enhet_id.  
+        * The org_enhet_id will be set according to the suggestions given in 
+        * the synchronize function in the rental model UI. 
+        * 
+        */
+       public function update_all_org_enhet_id()
+       {
+               $bofelles = rental_bofellesdata::get_instance();
+               
+               $result_objects = rental_soparty::get_instance()->get();
+               $result_count = rental_soparty::get_instance()->get_count();
+               
+               echo "Total number of parties: {$result_count}";
+               
+               if(($this->isExecutiveOfficer() || $this->isAdministrator()))
+               {
+                       $count = 0;
+                       $count_result_unit_number = 0;
+                       $count_identifier = 0;
+                       $count_responsibility = 0;
+                       $unit_found = false;
+                       
+                       //for all parties
+                       foreach ($result_objects as $party) {
+                               $unit_found = false;
+                               //if the party is an has not set "org_enhet_id"
+                               if(isset($party) && !$party->get_org_enhet_id())
+                               {
+                                       $serialized = 
$party->serialize($contract);
+                                       $sync_data = $party->get_sync_data();
 
+                                       //find a relevant org_enehet_id
+                                       $unit_name_and_id = 
$bofelles->result_unit_exist($sync_data['result_unit_number']);
+                                       if(!$unit_name_and_id)
+                                       {
+                                               $unit_name_and_id = 
$bofelles->result_unit_exist($party->get_identifier());
+                                       }
+                                       else{
+                                               $count_result_unit_number++;
+                                               
+                                               $unit_id_echo = 
$unit_name_and_id['UNIT_ID'];
+                                               $unit_name_echo = 
$unit_name_and_id['UNIT_NAME'];
+                                               echo "Unit id found 
{$unit_id_echo} by result unit number check. The unit name is 
{$unit_name_echo}";
+                                               
+                                               $unit_found = true;
+                                       }
+                                       
+                                       if(!$unit_name_and_id)
+                                       {
+                                               $unit_name_and_id = 
$bofelles->responsibility_id_exist($sync_data['responsibility_id']);
+                                       }
+                                       else if(!$unit_found){
+                                               $count_identifier++;
+                                               $unit_id_echo = 
$unit_name_and_id['UNIT_ID'];
+                                               $unit_name_echo = 
$unit_name_and_id['UNIT_NAME'];
+                                               echo "Unit id found 
{$unit_id_echo} by identifier check. The unit name is {$unit_name_echo}";
+                                               $unit_found = true;
+                                       }
+                                       
+                                       if(isset($unit_name_and_id))
+                                       {
+                                               if(!$unit_found){
+                                                       $unit_id_echo = 
$unit_name_and_id['UNIT_ID'];
+                                                       $unit_name_echo = 
$unit_name_and_id['UNIT_NAME'];
+                                                       echo "Unit id found 
{$unit_id_echo} by responsibility id check. The unit name is {$unit_name_echo}";
+                                                       $count_responsibility++;
+                                               }
+                                               
+                                               $unit_id = 
$unit_name_and_id['UNIT_ID'];
+                                               $unit_name = 
$unit_name_and_id['UNIT_NAME'];
+                                               
+                                               //if unit_id is found set it to 
the party
+                                               if(isset($unit_id) && 
is_numeric($unit_id))
+                                               {
+                                                       
$party->set_org_enhet_id($unit_id);
+                                                       
rental_soparty::get_instance()->store($party);
+                                                       $count++;
+                                               }
+                                       }
+                               }
+                       }
+                       echo "Number of parties found through result unit 
number {$count_result_unit_number}";
+                       echo "Number of parties found through identifier 
{$count_identifier}";
+                       echo "Number of parties found through responsibility id 
{$count_responsibility}";
+                       echo "Number of parties that have been updated 
{$count}";
+               }
+       }
+
        /**
         * Add action links for the context menu of the list item
         *




reply via email to

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