fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [7550] Merge 7543:7549 from trunk


From: Sigurd Nes
Subject: [Fmsystem-commits] [7550] Merge 7543:7549 from trunk
Date: Fri, 02 Sep 2011 09:01:17 +0000

Revision: 7550
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=7550
Author:   sigurdne
Date:     2011-09-02 09:01:16 +0000 (Fri, 02 Sep 2011)
Log Message:
-----------
Merge 7543:7549 from trunk

Modified Paths:
--------------
    branches/Version-1_0-branch/activitycalendar/inc/class.soarena.inc.php
    
branches/Version-1_0-branch/activitycalendar/inc/class.soorganization.inc.php
    branches/Version-1_0-branch/activitycalendar/inc/class.uiactivities.inc.php
    branches/Version-1_0-branch/activitycalendar/inc/class.uiarena.inc.php
    branches/Version-1_0-branch/activitycalendar/inc/class.uiimport.inc.php
    
branches/Version-1_0-branch/activitycalendar/inc/class.uiorganization.inc.php
    branches/Version-1_0-branch/activitycalendar/setup/phpgw_no.lang
    branches/Version-1_0-branch/activitycalendar/templates/base/arena.php
    branches/Version-1_0-branch/property/inc/class.uiwo_hour.inc.php
    
branches/Version-1_0-branch/property/inc/import/default/cvs_import_vedlikeholdsplan_bkb

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,6510-6511,6513,6515-6516,6518,6520-6524,6526-6528,6533-6534,6536-6541,6543-6565,6567,6569,6571-6576,6578,6580-6586,6588-6596,6598-6600,6602-6604,6606-6607,6609-6611,6613-6625,6629-6639,6641-6643,6645-6646,6648,6650-6654,6656-6659,6661-6663,6665-6666,6668-6669,6672-6673,6675,6677-6678,6680,6682-6686,6688-6717,6719,6721-6722,6724-6728,6730,6732-6734,6736-6739,6741,6743,6745-6746,6748-6756,6758-6762,6764,6766-6788,6790,6792-6798,6800-6814,6816-6819,6821-6822,6824-6826,6828-6837,6839,6841,6843-6849,6851,6853-6869,6871-6874,6876-6877,6879,6881,6883,6885-6886,6888-6893,6895-6897,6899-6901,6903,6905-6907,6909,6911-6929,6931-6936,6938-6947,6949,6951,6953,6955-6956,6958-6959,6961-6968,6970-6971,6973-6974,6976-6978,6980,6982-7017,7019-7025,7027-7035,7037-7039,7041-7045,7047-7055,7057,7059-7065,7067-7069,7071,7073,7075-7076,7078,7080-7081,7083,7085,7087,7089-7097,7099-7102,7104-7105,7107-7111,7113-7120,7122-7124,7126-7129,7131,7133-7141,7143,7145-7146,7148-7150,7152-7153,7155-7158,7160-7164,7166-7167,7169-7170,7172,7174,7176,7178,7180-7181,7183,7185,7187-7188,7190,7192-7196,7198-7199,7201-7203,7205,7207,7209-7210,7212,7214,7216-7217,7219-7222,7224-7226,7228-7229,7231,7233-7234,7236-7238,7240-7241,7243-7244,7246,7248,7250,7252-7256,7258-7259,7261-7264,7266-7273,7275-7279,7281-7332,7334-7338,7340-7348,7350,7352-7353,7355-7361,7363-7366,7368-7370,7372,7374,7376,7378,7380-7386,7388-7400,7402,7404-7433,7435-7439,7441-7446,7448-7458,7460-7469,7471-7483,7485-7487,7489-7490,7492,7494,7496-7497,7499,7501-7502,7504,7506-7507,7509-7511,7513-7517,7519-7521,7523,7525,7527-7529,7531,7533,7535-7538,7540-7542
   + 
/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,6513,6515-6516,6518,6520-6524,6526-6528,6533-6534,6536-6541,6543-6565,6567,6569,6571-6576,6578,6580-6586,6588-6596,6598-6600,6602-6604,6606-6607,6609-6611,6613-6625,6629-6639,6641-6643,6645-6646,6648,6650-6654,6656-6659,6661-6663,6665-6666,6668-6669,6672-6673,6675,6677-6678,6680,6682-6686,6688-6717,6719,6721-6722,6724-6728,6730,6732-6734,6736-6739,6741,6743,6745-6746,6748-6756,6758-6762,6764,6766-6788,6790,6792-6798,6800-6814,6816-6819,6821-6822,6824-6826,6828-6837,6839,6841,6843-6849,6851,6853-6869,6871-6874,6876-6877,6879,6881,6883,6885-6886,6888-6893,6895-6897,6899-6901,6903,6905-6907,6909,6911-6929,6931-6936,6938-6947,6949,6951,6953,6955-6956,6958-6959,6961-6968,6970-6971,6973-6974,6976-6978,6980,6982-7017,7019-7025,7027-7035,7037-7039,7041-7045,7047-7055,7057,7059-7065,7067-7069,7071,7073,7075-7076,7078,7080-7081,7083,7085,7087,7089-7097,7099-7102,7104-7105,7107-7111,7113-7120,7122-7124,7126-7129,7131,7133-7141,7143,7145-7146,7148-7150,7152-7153,7155-7158,7160-7164,7166-7167,7169-7170,7172,7174,7176,7178,7180-7181,7183,7185,7187-7188,7190,7192-7196,7198-7199,7201-7203,7205,7207,7209-7210,7212,7214,7216-7217,7219-7222,7224-7226,7228-7229,7231,7233-7234,7236-7238,7240-7241,7243-7244,7246,7248,7250,7252-7256,7258-7259,7261-7264,7266-7273,7275-7279,7281-7332,7334-7338,7340-7348,7350,7352-7353,7355-7361,7363-7366,7368-7370,7372,7374,7376,7378,7380-7386,7388-7400,7402,7404-7433,7435-7439,7441-7446,7448-7458,7460-7469,7471-7483,7485-7487,7489-7490,7492,7494,7496-7497,7499,7501-7502,7504,7506-7507,7509-7511,7513-7517,7519-7521,7523,7525,7527-7529,7531,7533,7535-7538,7540-7542,7544-7549

Modified: branches/Version-1_0-branch/activitycalendar/inc/class.soarena.inc.php
===================================================================
--- branches/Version-1_0-branch/activitycalendar/inc/class.soarena.inc.php      
2011-09-02 08:59:18 UTC (rev 7549)
+++ branches/Version-1_0-branch/activitycalendar/inc/class.soarena.inc.php      
2011-09-02 09:01:16 UTC (rev 7550)
@@ -254,7 +254,8 @@
                $values = array(
                        'arena_name = '         . 
$this->marshal($arena->get_arena_name(), 'string'),
                        'address = '     . 
$this->marshal($arena->get_address(), 'string'),
-                       'internal_arena_id =  '     . 
$this->marshal($arena->get_internal_arena_id(), 'int')
+                       'internal_arena_id =  '     . 
$this->marshal($arena->get_internal_arena_id(), 'int'),
+                       'active = '     . $this->marshal(($arena->is_active() ? 
'true' : 'false'), 'bool'),
                );
                
                $result = $this->db->query('UPDATE activity_arena SET ' . 
join(',', $values) . " WHERE id=$id", __LINE__,__FILE__);

Modified: 
branches/Version-1_0-branch/activitycalendar/inc/class.soorganization.inc.php
===================================================================
--- 
branches/Version-1_0-branch/activitycalendar/inc/class.soorganization.inc.php   
    2011-09-02 08:59:18 UTC (rev 7549)
+++ 
branches/Version-1_0-branch/activitycalendar/inc/class.soorganization.inc.php   
    2011-09-02 09:01:16 UTC (rev 7550)
@@ -317,5 +317,116 @@
                }
                return $organization;
        }
+       
+       function add_organization_local($organization)
+       {
+               $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();
+/*             $zip = $organization->get_();
+               if($zip && strlen($zip) > 5)
+               {
+                       $zip_code = substr($zip,0,4);
+                       $city = substr($zip, 5);
+               }
+               else
+               {
+                       $zip_code = '';
+                       $city = '';
+               }*/
+               $district = $organization->get_district();
+               
+               $values[] = "NAME='{$name}'";
+               $values[] = "HOMEPAGE='{$homepage}'";
+               $values[] = "PHONE='{$phone}'";
+               $values[] = "EMAIL='{$email}'";
+               $values[] = "DESCRIPTION='{$description}'";
+               $values[] = "STREET='{$street}'";
+               //$values[] = "'{$zip_code}'";
+               //$values[] = "'{$city}'";
+               $values[] = "ORGNO='{$orgnr}'";
+               $values[] = "DISTRICT='{$district}'";
+               $vals = implode(',',$values);
+               
+               //var_dump("INSERT INTO activity_organization ({$cols}) VALUES 
({$vals})");
+               $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;
+               }
+       }
+       
+       function transfer_organization($org_info)
+       {
+               $name = $org_info['name'];
+               $orgnr = $org_info['orgnr'];
+               $homepage = $org_info['homepage'];
+               $phone = $org_info['phone'];
+               $email = $org_info['email'];
+               $description = $org_info['description'];
+               $street = $org_info['street'];
+               $zip = $org_info['zip'];
+               if($zip && strlen($zip) > 5)
+               {
+                       $zip_code = substr($zip,0,4);
+                       $city = substr($zip, 5);
+               }
+               else
+               {
+                       $zip_code = '';
+                       $city = '';
+               }
+               $district = $org_info['district'];
+               $activity_id = $org_info['activity_id'];
+               $show_in_portal = 1; 
+               
+               $columns[] = 'name';
+               $columns[] = 'homepage';
+               $columns[] = 'phone';
+               $columns[] = 'email';
+               $columns[] = 'description';
+               $columns[] = 'street';
+               $columns[] = 'zip_code';
+               $columns[] = 'city';
+               $columns[] = 'district';
+               $columns[] = 'organization_number';
+               $columns[] = 'activity_id';
+               $columns[] = 'show_in_portal';
+               $cols = implode(',',$columns);
+               
+               $values[] = "'{$name}'";
+               $values[] = "'{$homepage}'";
+               $values[] = "'{$phone}'";
+               $values[] = "'{$email}'";
+               $values[] = "'{$description}'";
+               $values[] = "'{$street}'";
+               $values[] = "'{$zip_code}'";
+               $values[] = "'{$city}'";
+               $values[] = "'{$district}'";
+               $values[] = "'{$orgnr}'";
+               $values[] = $this->marshal($activity_id, 'int');
+               $values[] = $show_in_portal;
+               $vals = implode(',',$values);
+               
+               $sql = "INSERT INTO bb_organization ({$cols}) VALUES ({$vals})";
+       $result = $this->db->query($sql, __LINE__, __FILE__);
+               if(isset($result))
+               {
+                       return $this->db->get_last_insert_id('bb_organization', 
'id');
+               }
+               else
+               {
+                       return 0;
+               }
+       }
 }
 ?>

Modified: 
branches/Version-1_0-branch/activitycalendar/inc/class.uiactivities.inc.php
===================================================================
--- branches/Version-1_0-branch/activitycalendar/inc/class.uiactivities.inc.php 
2011-09-02 08:59:18 UTC (rev 7549)
+++ branches/Version-1_0-branch/activitycalendar/inc/class.uiactivities.inc.php 
2011-09-02 09:01:16 UTC (rev 7550)
@@ -362,7 +362,8 @@
        {
                //$subject = lang('mail_subject_update', $avtivity->get_id() . 
'-' . $activity->get_title(), $activity->get_link());
                $subject = lang('mail_subject_update');
-               $body = lang('mail_body_update', $activity->get_id() . ', ' . 
$activity->get_title());
+               $link_text = 
"http://www.bergen.kommune.no/portico/aktivitycalendarfrontend/?menuaction=activitycalendarfrontend.uiactivity.edit&id={$activity->get_id()}&secret={$activity->get_secret()}";
+               $body = lang('mail_body_update', $activity->get_id() . ', ' . 
$activity->get_title(), $link_text);
        }
        else
        {

Modified: branches/Version-1_0-branch/activitycalendar/inc/class.uiarena.inc.php
===================================================================
--- branches/Version-1_0-branch/activitycalendar/inc/class.uiarena.inc.php      
2011-09-02 08:59:18 UTC (rev 7549)
+++ branches/Version-1_0-branch/activitycalendar/inc/class.uiarena.inc.php      
2011-09-02 09:01:16 UTC (rev 7550)
@@ -105,6 +105,7 @@
                                
$arena->set_internal_arena_id(phpgw::get_var('internal_arena_id'));
                                
$arena->set_arena_name(phpgw::get_var('arena_name'));
                                $arena->set_address(phpgw::get_var('address') . 
' ' . phpgw::get_var('address_no'));
+                               
$arena->set_active(phpgw::get_var('arena_active') == 'on' ? true : false);
                                
                                
if(activitycalendar_soarena::get_instance()->store($arena)) // ... and then try 
to store the object
                                {

Modified: 
branches/Version-1_0-branch/activitycalendar/inc/class.uiimport.inc.php
===================================================================
--- branches/Version-1_0-branch/activitycalendar/inc/class.uiimport.inc.php     
2011-09-02 08:59:18 UTC (rev 7549)
+++ branches/Version-1_0-branch/activitycalendar/inc/class.uiimport.inc.php     
2011-09-02 09:01:16 UTC (rev 7550)
@@ -341,7 +341,7 @@
                                                $contact2['mail'] = 
$contact_mail_2;
                                                $contact2['org_id'] = 
$this->decode($activity_org);
                                                
$soactivity->add_contact_person_org($contact2);
-                                               
+/*                                             
                                                //group-stuff:
                                                if($activity_group)
                                                {
@@ -369,9 +369,9 @@
                                                        $activity_persons = 
activitycalendar_sogroup::get_instance()->get_contacts($new_group_id);
                                                }
                                                else
-                                               {
+                                               {*/
                                                        $activity_persons = 
activitycalendar_soorganization::get_instance()->get_contacts($activity_org);
-                                               }
+                                               /*}*/
 /*                                             
                                                foreach($activity_persons as 
$pers)
                                                {
@@ -400,7 +400,7 @@
                                                */
                                                //$activity_persons = 
activitycalendar_soorganization::get_instance()->get_contacts($activity_org);
                                        }
-                                       else    //add org unit
+/*                                     else    //add org unit
                                        {
                                                $org_info = array();
                                                $org_info['name'] = 
$org_name_tmp; //new
@@ -465,9 +465,9 @@
                                                {
                                                        $activity_persons = 
activitycalendar_soorganization::get_instance()->get_contacts($new_org_id);
                                                }
-                                       }
+                                       }*/
                                }
-                               else    //add org unit without org no
+/*                             else    //add org unit without org no
                                {
                                        $org_info = array();
                                        if($activity_group && !$activity_group 
== '')
@@ -535,6 +535,7 @@
                                                $activity_persons = 
activitycalendar_soorganization::get_instance()->get_contacts($new_org_id);
                                        }
                                }
+                               */
                                
                                $activity_adapted = $this->decode($data[4]);
                                $activity_target = $this->decode($data[7]);

Modified: 
branches/Version-1_0-branch/activitycalendar/inc/class.uiorganization.inc.php
===================================================================
--- 
branches/Version-1_0-branch/activitycalendar/inc/class.uiorganization.inc.php   
    2011-09-02 08:59:18 UTC (rev 7549)
+++ 
branches/Version-1_0-branch/activitycalendar/inc/class.uiorganization.inc.php   
    2011-09-02 09:01:16 UTC (rev 7550)
@@ -68,6 +68,9 @@
                $GLOBALS['phpgw_info']['flags']['app_header'] .= 
'::'.lang('edit');
                $id = (int)phpgw::get_var('id');
                $type = phpgw::get_var('type');
+               unset($org_info);
+               unset($contact1);
+               unset($contact2);
                if($type)
                {
                        //var_dump($type);
@@ -77,7 +80,7 @@
                                $keys = array_keys($group_array);
                                $group = $group_array[$keys[0]];
                        }
-                       if(isset($_POST['save_organization'])) // The user has 
pressed the save button
+                       if(isset($_POST['save_group'])) // The user has pressed 
the save button
                        {
                                $orgno = phpgw::get_var('orgno');
                                $district = phpgw::get_var('org_district');
@@ -87,7 +90,7 @@
                                $address = phpgw::get_var('address');
                                $desc = phpgw::get_var('org_description');
                        }
-                       else if(isset($_POST['store_organization'])) // The 
user has pressed the store button
+                       else if(isset($_POST['store_group'])) // The user has 
pressed the store button
                        {
                                $orgno = phpgw::get_var('orgno');
                                $district = phpgw::get_var('org_district');
@@ -112,6 +115,7 @@
                        //var_dump('org');
                        $so = activitycalendar_soorganization::get_instance();
                        $so_activity = 
activitycalendar_soactivity::get_instance();
+                       $so_contact = 
activitycalendar_socontactperson::get_instance();
                        $org_array = $so->get(null, null, null, null, null, 
null, array('id' => $id, 'changed_orgs' => 'true'));
                        if(count($org_array)>0){
                                $keys = array_keys($org_array);
@@ -130,7 +134,7 @@
                                $org->set_address(phpgw::get_var('address'));
                                
$org->set_description(phpgw::get_var('org_description'));
                                
-                               if($so->store($org))
+                               if($so->update_local_org($org))
                                {
                                        $message = lang('messages_saved_form'); 
                                }
@@ -138,9 +142,6 @@
                                {
                                        $error = lang('messages_form_error');
                                }
-                               
-                               
-                               
                        }
                        else if(isset($_POST['store_organization'])) // The 
user has pressed the store button
                        {
@@ -149,8 +150,54 @@
                                $homepage = phpgw::get_var('homepage');
                                $email = phpgw::get_var('email');
                                $phone = phpgw::get_var('phone');
-                               $address = phpgw::get_var('address');
+                               $address_tmp = phpgw::get_var('address');
+                               //phpgw::get_var('address') . ' ' . 
phpgw::get_var('number') . ', ' . phpgw::get_var('postaddress');
+                               $address_array = explode(",",$address_tmp);
                                $desc = phpgw::get_var('org_description');
+                               
+                               $org_info = array();
+                               $org_info['name'] = $org->get_name(); //new
+                               $orgno_tmp = $orgno;
+                               if(strlen($orgno_tmp) > 9)
+                               {
+                                       $orgno_tmp = NULL;
+                               }
+                               $org_info['orgnr'] = $orgno_tmp; 
+                               
+                               $org_info['homepage'] = $homepage;
+                               $org_info['phone'] = $phone;
+                               $org_info['email'] = $email;
+                               $org_info['description'] = $description;
+                               $org_info['street'] = $address_array[0];
+                               $org_info['zip'] = $address_array[1];
+                               $org_info['activity_id'] = '';
+                               $org_info['district'] = $district;
+                               
+                               $new_org_id = 
$so->transfer_organization($org_info);
+                               if($new_org_id)
+                               {
+                                       //update activity with new org id
+                                       //add contact persons to booking
+                                       $contact1 = array();
+                                       $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);
+                                       
+                                       $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);
+                                       $message = lang('messages_saved_form'); 
+                               }
+                               else
+                               {
+                                       $error = lang('messages_form_error');
+                               }
+                               
                        }
                        
                        $data = array

Modified: branches/Version-1_0-branch/activitycalendar/setup/phpgw_no.lang
===================================================================
--- branches/Version-1_0-branch/activitycalendar/setup/phpgw_no.lang    
2011-09-02 08:59:18 UTC (rev 7549)
+++ branches/Version-1_0-branch/activitycalendar/setup/phpgw_no.lang    
2011-09-02 09:01:16 UTC (rev 7550)
@@ -348,6 +348,7 @@
 organization_id        activitycalendar        no      Organisasjon ID
 arena_type     activitycalendar        no      Arenatype
 internal_arena_id      activitycalendar        no      Intern arena ID
+internal_arena activitycalendar        no      Intern arena
 reset  activitycalendar        no      Nullstill
 organization_number    activitycalendar        no      Organisasjonsnummer
 elements_pr_page       activitycalendar        no      elementer per side
@@ -387,4 +388,7 @@
 arena_name     activitycalendar        no      Navn
 Send mail to selection activitycalendar        no      Send E-post til utvalg
 contact_person_2_address       activitycalendar        no      Adresse for 
kulturkontoret
-contact_person_2_zip   activitycalendar        no      Poststed for 
kulturkontoret
\ No newline at end of file
+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

Modified: branches/Version-1_0-branch/activitycalendar/templates/base/arena.php
===================================================================
--- branches/Version-1_0-branch/activitycalendar/templates/base/arena.php       
2011-09-02 08:59:18 UTC (rev 7549)
+++ branches/Version-1_0-branch/activitycalendar/templates/base/arena.php       
2011-09-02 09:01:16 UTC (rev 7550)
@@ -108,6 +108,19 @@
                                        }
                                        ?>
                                </dd>
+                               <?php if($editable) {?>
+                                       <dt>
+                                               <label for="arena_active"><?php 
echo lang('active_arena') ?></label>
+                                       </dt>
+                                       <dd>
+                                               <input type="checkbox" 
name="arena_active" id="arena_active" <?php if($arena->is_active()) { echo 
"checked='checked'";} ?>/>
+                                       </dd>
+                               <?php 
+                               }else{ 
+                               ?>
+                                       <dt><label><?php 
if($arena->is_active()){?><font style="color: green;"><?php echo 
lang('active_arena');?></font><?php }else{ ?><font style="color: red;"><?php 
echo lang('inactive_arena');?></font><?php } ?></label></dt>
+                                       <dd>&nbsp;</dd>
+                               <?php }?>
                        </dl>
                        <div class="form-buttons">
                                <?php

Modified: branches/Version-1_0-branch/property/inc/class.uiwo_hour.inc.php
===================================================================
--- branches/Version-1_0-branch/property/inc/class.uiwo_hour.inc.php    
2011-09-02 08:59:18 UTC (rev 7549)
+++ branches/Version-1_0-branch/property/inc/class.uiwo_hour.inc.php    
2011-09-02 09:01:16 UTC (rev 7550)
@@ -1544,7 +1544,7 @@
                                        {
                                                $GLOBALS['phpgw']->send = 
CreateObject('phpgwapi.send');
                                        }
-                                       $rcpt = 
$GLOBALS['phpgw']->send->msg('email', $to_email, $subject, $body, '', $cc, 
$bcc, $from_email, $from_name, 'html', '', $attachments);
+                                       $rcpt = 
$GLOBALS['phpgw']->send->msg('email', $to_email, $subject, $body, '', $cc, 
$bcc, $from_email, $from_name, 'html', '', $attachments, true);
                                }
                                else
                                {

Modified: 
branches/Version-1_0-branch/property/inc/import/default/cvs_import_vedlikeholdsplan_bkb
===================================================================
--- 
branches/Version-1_0-branch/property/inc/import/default/cvs_import_vedlikeholdsplan_bkb
     2011-09-02 08:59:18 UTC (rev 7549)
+++ 
branches/Version-1_0-branch/property/inc/import/default/cvs_import_vedlikeholdsplan_bkb
     2011-09-02 09:01:16 UTC (rev 7550)
@@ -22,7 +22,15 @@
                        $error = false;
                        $type = $data[0];
                        $location_arr = explode('-',$data[1]);
-                       $location_code = $location_arr[0] . '-' . 
sprintf("%02d",$data[2]); 
+                       
+                       if(strpos($location_arr[0], 'A') !== false )
+                       {
+                               $location_code = $location_arr[0] . '-' . 
sprintf("%04d",$data[2]);
+                       }
+                       else
+                       {
+                               $location_code = $location_arr[0] . '-' . 
sprintf("%02d",$data[2]);                     
+                       }
 
                        $location_data = 
execMethod('property.solocation.read_single', $location_code );
 
@@ -129,10 +137,10 @@
                                        $category = 14;
                                        break;
                                case 'Kombinasjon':
-                                       $category = 201;
+                                       $category = 202;
                                        break;
                                default:
-                                       $category = 201;
+                                       $category = 202;
                                        break;
 
                        }
@@ -155,19 +163,20 @@
                        reset($this->attrib_data);
                        foreach ( $this->attrib_data as $attrib )
                        {
-                               if($attrib['datatype'] == 'LB' && 
$attrib['column_name'] == 'lovhjemmel')
+                               if($attrib['datatype'] == 'LB' && 
$attrib['column_name'] == 'hjemmel')
                                {
                                        foreach($attrib['choice'] as $choice)
                                        {
                                                if(strpos($choice['value'], 
$data[11]) !== false)
                                                {
-                                                       
$value_set['lovhjemmel']        = $choice['id'];
+                                                       $value_set['hjemmel']   
= $choice['id'];
                                                        break 2;
                                                }
                                        }
                                }
                        }
 
+/*
                        reset($this->attrib_data);
                        foreach ( $this->attrib_data as $attrib )
                        {
@@ -183,9 +192,9 @@
                                        }
                                }
                        }
+*/
 
 
-
                        $cols = implode(',', array_keys($value_set));
                        $values = 
$this->db->validate_insert(array_values($value_set));
 
@@ -207,12 +216,15 @@
                        $condition = array();
                        $condition_type = (int) substr($data[14], 0, 1);
 //_debug_array($data);                 
-                       $condition[$condition_type] = array
-                       (
-                               'degree'                => $data[13] ? 
(int)$data[13] : 1,
-                               'probability'   =>      $data[16] ? 
(int)$data[16] : 1,
-                               'consequence'   =>      $data[15] ? 
(int)$data[15] : 1,
-                       );
+                       if($condition_type)
+                       {
+                               $condition[$condition_type] = array
+                               (
+                                       'degree'                => $data[13] ? 
(int)$data[13] : 0,
+                                       'probability'   =>      $data[16] ? 
(int)$data[16] : 0,
+                                       'consequence'   =>      $data[15] ? 
(int)$data[15] : 0,
+                               );
+                       }
                        
 //_debug_array($condition);                    
                        foreach ($condition as $condition_type => $value_type)




reply via email to

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