phpgroupware-cvs
[Top][All Lists]
Advanced

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

[Phpgroupware-cvs] property/inc class.bocommon.inc.php cron/forwar...


From: Sigurd Nes
Subject: [Phpgroupware-cvs] property/inc class.bocommon.inc.php cron/forwar...
Date: Sun, 18 Mar 2007 16:26:56 +0000

CVSROOT:        /sources/phpgroupware
Module name:    property
Changes by:     Sigurd Nes <sigurdne>   07/03/18 16:26:56

Modified files:
        inc            : class.bocommon.inc.php 
        inc/cron       : forward_mail_as_sms.php 
                         oppdater_namssakstatus_pr_leietaker.php 
                         synkroniser_med_boei.php 

Log message:
        

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/property/inc/class.bocommon.inc.php?cvsroot=phpgroupware&r1=1.63&r2=1.64
http://cvs.savannah.gnu.org/viewcvs/property/inc/cron/forward_mail_as_sms.php?cvsroot=phpgroupware&r1=1.3&r2=1.4
http://cvs.savannah.gnu.org/viewcvs/property/inc/cron/oppdater_namssakstatus_pr_leietaker.php?cvsroot=phpgroupware&r1=1.2&r2=1.3
http://cvs.savannah.gnu.org/viewcvs/property/inc/cron/synkroniser_med_boei.php?cvsroot=phpgroupware&r1=1.2&r2=1.3

Patches:
Index: class.bocommon.inc.php
===================================================================
RCS file: /sources/phpgroupware/property/inc/class.bocommon.inc.php,v
retrieving revision 1.63
retrieving revision 1.64
diff -u -b -r1.63 -r1.64
--- class.bocommon.inc.php      16 Mar 2007 14:14:56 -0000      1.63
+++ class.bocommon.inc.php      18 Mar 2007 16:26:56 -0000      1.64
@@ -24,7 +24,7 @@
        * @internal Development of this application was funded by 
http://www.bergen.kommune.no/bbb_/ekstern/
        * @package property
        * @subpackage core
-       * @version $Id: class.bocommon.inc.php,v 1.63 2007/03/16 14:14:56 
sigurdne Exp $
+       * @version $Id: class.bocommon.inc.php,v 1.64 2007/03/18 16:26:56 
sigurdne Exp $
        */
 
        /**
@@ -1459,10 +1459,10 @@
                }
                
                /**
-               * Converts ascii to utf-8
+               * Converts utf-8 to ascii
                *
                * @param string $text string
-               * @return string utf-8 encoded 
+               * @return string ascii encoded 
                */
                function utf2ascii($text = '')
                {       
@@ -1475,5 +1475,23 @@
                                return utf8_decode($text);
                        }
                }
+
+               /**
+               * Converts ascii to utf-8
+               *
+               * @param string $text string
+               * @return string utf-8 encoded 
+               */
+               function ascii2utf($text = '')
+               {       
+                       if 
($GLOBALS['phpgw_info']['server']['charset']=='utf-8')
+                       {
+                               return utf8_encode($text);
+                       }
+                       else
+                       {
+                               return $text;
+                       }
+               }               
        }
 ?>

Index: cron/forward_mail_as_sms.php
===================================================================
RCS file: /sources/phpgroupware/property/inc/cron/forward_mail_as_sms.php,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -b -r1.3 -r1.4
--- cron/forward_mail_as_sms.php        16 Mar 2007 08:57:05 -0000      1.3
+++ cron/forward_mail_as_sms.php        18 Mar 2007 16:26:56 -0000      1.4
@@ -8,7 +8,7 @@
        * @internal Development of this application was funded by 
http://www.bergen.kommune.no/bbb_/ekstern/
        * @package property
        * @subpackage custom
-       * @version $Id: forward_mail_as_sms.php,v 1.3 2007/03/16 08:57:05 
sigurdne Exp $
+       * @version $Id: forward_mail_as_sms.php,v 1.4 2007/03/18 16:26:56 
sigurdne Exp $
        */
 
        /**
@@ -25,7 +25,7 @@
                {
                        $this->currentapp       = 
$GLOBALS['phpgw_info']['flags']['currentapp'];
                        $this->bocommon         = 
CreateObject($this->currentapp.'.bocommon');
-                       $this->db                       = 
$this->bocommon->new_db();
+                       $this->db                       = & 
$GLOBALS['phpgw']->db;
                }
 
                function pre_run($data='')

Index: cron/oppdater_namssakstatus_pr_leietaker.php
===================================================================
RCS file: 
/sources/phpgroupware/property/inc/cron/oppdater_namssakstatus_pr_leietaker.php,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -b -r1.2 -r1.3
--- cron/oppdater_namssakstatus_pr_leietaker.php        16 Mar 2007 08:57:05 
-0000      1.2
+++ cron/oppdater_namssakstatus_pr_leietaker.php        18 Mar 2007 16:26:56 
-0000      1.3
@@ -24,7 +24,7 @@
        * @internal Development of this application was funded by 
http://www.bergen.kommune.no/bbb_/ekstern/
        * @package property
        * @subpackage custom
-       * @version $Id: oppdater_namssakstatus_pr_leietaker.php,v 1.2 
2007/03/16 08:57:05 sigurdne Exp $
+       * @version $Id: oppdater_namssakstatus_pr_leietaker.php,v 1.3 
2007/03/18 16:26:56 sigurdne Exp $
        */
 
        /**
@@ -46,6 +46,8 @@
                        $this->like                             = 
$this->db->like;
                        $this->left_join                = " LEFT JOIN ";
 
+                       
if($GLOBALS['phpgw_info']['server']['db_abstraction']=='adodb')
+                       {
                        $this->db_boei                  = 
CreateObject('phpgwapi.db',false,$GLOBALS['external_db']['boei']['db_type']);
                        $this->db_boei->Host            = 
$GLOBALS['external_db']['boei']['db_host'];
                        $this->db_boei->Type            = 
$GLOBALS['external_db']['boei']['db_type'];
@@ -55,6 +57,17 @@
                        $this->db_boei->Halt_On_Error   = 'yes';                
        
                        $this->db_boei->connect();              
                }
+                       else
+                       {
+                               $this->db_boei                  = 
CreateObject($this->currentapp.'.db_mssql');
+                               $this->db_boei->Host            = 
$GLOBALS['external_db']['boei']['db_host'];
+                               $this->db_boei->Type            = 
$GLOBALS['external_db']['boei']['db_type'];
+                               $this->db_boei->Database        = 
$GLOBALS['external_db']['boei']['db_name'];
+                               $this->db_boei->User            = 
$GLOBALS['external_db']['boei']['db_user'];
+                               $this->db_boei->Password        = 
$GLOBALS['external_db']['boei']['db_pass'];
+                               $this->db_boei->Halt_On_Error   = 'yes';
+                       }
+               }
 
                function pre_run($data='')
                {

Index: cron/synkroniser_med_boei.php
===================================================================
RCS file: /sources/phpgroupware/property/inc/cron/synkroniser_med_boei.php,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -b -r1.2 -r1.3
--- cron/synkroniser_med_boei.php       16 Mar 2007 08:57:05 -0000      1.2
+++ cron/synkroniser_med_boei.php       18 Mar 2007 16:26:56 -0000      1.3
@@ -24,7 +24,7 @@
        * @internal Development of this application was funded by 
http://www.bergen.kommune.no/bbb_/ekstern/
        * @package property
        * @subpackage custom
-       * @version $Id: synkroniser_med_boei.php,v 1.2 2007/03/16 08:57:05 
sigurdne Exp $
+       * @version $Id: synkroniser_med_boei.php,v 1.3 2007/03/18 16:26:56 
sigurdne Exp $
        */
 
        /**
@@ -45,6 +45,8 @@
                        $this->like                             = 
$this->db->like;
                        $this->left_join                = " LEFT JOIN ";
 
+                       
if($GLOBALS['phpgw_info']['server']['db_abstraction']=='adodb')
+                       {
                        $this->db_boei                  = 
CreateObject('phpgwapi.db',false,$GLOBALS['external_db']['boei']['db_type']);
                        $this->db_boei->Host            = 
$GLOBALS['external_db']['boei']['db_host'];
                        $this->db_boei->Type            = 
$GLOBALS['external_db']['boei']['db_type'];
@@ -53,6 +55,18 @@
                        $this->db_boei->Password        = 
$GLOBALS['external_db']['boei']['db_pass'];
                        $this->db_boei->Halt_On_Error   = 'yes';                
        
                        $this->db_boei->connect();              
+                       }
+                       else
+                       {
+                               $this->db_boei                  = 
CreateObject($this->currentapp.'.db_mssql');
+                               $this->db_boei->Host            = 
$GLOBALS['external_db']['boei']['db_host'];
+                               $this->db_boei->Type            = 
$GLOBALS['external_db']['boei']['db_type'];
+                               $this->db_boei->Database        = 
$GLOBALS['external_db']['boei']['db_name'];
+                               $this->db_boei->User            = 
$GLOBALS['external_db']['boei']['db_user'];
+                               $this->db_boei->Password        = 
$GLOBALS['external_db']['boei']['db_pass'];
+                               $this->db_boei->Halt_On_Error   = 'yes';
+                       }
+                       
                        $this->db_boei2 = clone($this->db_boei);
                }
 
@@ -228,8 +242,8 @@
                                }
                                $owner_utf[]= array (
                                 'id'           => $this->db_boei->f('id'),
-                                'org_name'     => 
$this->db->db_addslashes(utf8_encode($this->db_boei->f('org_name'))),
-                                'remark'       => 
$this->db->db_addslashes(utf8_encode($this->db_boei->f('org_name'))),
+                                'org_name'     => 
$this->db->db_addslashes($this->bocommon->ascii2utf($this->db_boei->f('org_name'))),
+                                'remark'       => 
$this->db->db_addslashes($this->bocommon->ascii2utf($this->db_boei->f('org_name'))),
                                 'category'     => $category,
                                 'entry_date'   => time(),
                                 'owner_id'             => 6
@@ -299,13 +313,13 @@
                                        . " VALUES (" . $gate[$i]['id'] . ", 
'". $gate[$i]['descr']. "')";
 
                                $sql2_utf = "INSERT INTO fm_streetaddress 
(id,descr)"
-                                       . " VALUES (" . $gate[$i]['id'] . ", 
'". utf8_encode($gate[$i]['descr']). "')";
+                                       . " VALUES (" . $gate[$i]['id'] . ", 
'". $this->bocommon->ascii2utf($gate[$i]['descr']). "')";
 
                                $this->db->query($sql,__LINE__,__FILE__);
                                $this->db_boei->query($sql,__LINE__,__FILE__);
                                $this->db->query($sql2_utf,__LINE__,__FILE__);
                                
$this->db_boei->query($sql2_latin,__LINE__,__FILE__);
-                               $gate_msg[]=utf8_encode($gate[$i]['descr']);
+                               
$gate_msg[]=$this->bocommon->ascii2utf($gate[$i]['descr']);
                        }
 
                        $this->db->transaction_commit();
@@ -332,7 +346,7 @@
                                $objekt_utf[]= array (
                                 'location_code'        => 
$this->db_boei->f('objekt_id'),
                                 'loc1'                         => 
$this->db_boei->f('objekt_id'),
-                                'loc1_name'            => 
utf8_encode($this->db_boei->f('navn')),
+                                'loc1_name'            => 
$this->bocommon->ascii2utf($this->db_boei->f('navn')),
                                 'part_of_town_id'      => 
$this->db_boei->f('bydel_id'),
                                 'owner_id'             => 
$this->db_boei->f('eier_id'),
                                 'kostra_id'            => 
$this->db_boei->f('tjenestested')
@@ -390,7 +404,7 @@
                                 'location_code'        => 
$this->db_boei->f('location_code'),
                                 'loc1'                         => 
$this->db_boei->f('objekt_id'),
                                 'loc2'                         => 
$this->db_boei->f('bygg_id'),
-                                'loc2_name'            => 
utf8_encode($this->db_boei->f('byggnavn')),
+                                'loc2_name'            => 
$this->bocommon->ascii2utf($this->db_boei->f('byggnavn')),
                                 );
                                $bygg_latin[]= array (
                                 'location_code'        => 
$this->db_boei->f('location_code'),
@@ -447,7 +461,7 @@
                                 'loc1'                         => 
$this->db_boei->f('objekt_id'),
                                 'loc2'                         => 
$this->db_boei->f('bygg_id'),
                                 'loc3'                         => 
$this->db_boei->f('seksjons_id'),
-                                'loc3_name'            => 
utf8_encode($this->db_boei->f('beskrivelse')),
+                                'loc3_name'            => 
$this->bocommon->ascii2utf($this->db_boei->f('beskrivelse')),
                                 'fellesareal'  => 
$this->db_boei->f('totalt_fellesareal')
                                 );
                                $seksjon_latin[]= array (
@@ -513,8 +527,8 @@
                                 'loc3'                         => 
$this->db_boei->f('seksjons_id'),
                                 'category'             => 
$this->db_boei->f('formaal_id'),
                                 'street_id'            => 
$this->db_boei->f('gateadresse_id'),
-                                'street_number'        => 
utf8_encode($this->db_boei->f('gatenr')),
-                                'etasje'                       => 
utf8_encode($this->db_boei->f('etasje')),
+                                'street_number'        => 
$this->bocommon->ascii2utf($this->db_boei->f('gatenr')),
+                                'etasje'                       => 
$this->bocommon->ascii2utf($this->db_boei->f('etasje')),
                                 'antallrom'            => 
$this->db_boei->f('antallrom'),
                                 'boareal'                      => 
$this->db_boei->f('boareal'),
                                 'livslopsstd'          => 
$this->db_boei->f('livslopsstd'),
@@ -588,8 +602,8 @@
                        {
                                $leietaker_utf[]= array (
                                 'id'                           => 
$this->db_boei->f('leietaker_id'),
-                                'first_name'           => 
utf8_encode($this->db_boei->f('fornavn')),
-                                'last_name'            => 
utf8_encode($this->db_boei->f('etternavn')),
+                                'first_name'           => 
$this->bocommon->ascii2utf($this->db_boei->f('fornavn')),
+                                'last_name'            => 
$this->bocommon->ascii2utf($this->db_boei->f('etternavn')),
                                 'category'                     => 
$this->db_boei->f('kjonn_juridisk') + 1,
                                 'status_eco'           => 
$this->db_boei->f('namssakstatusokonomi_id'),
                                 'status_drift'         => 
$this->db_boei->f('namssakstatusdrift_id'),
@@ -652,9 +666,9 @@
                                $sql2_utf = " UPDATE  fm_location4 SET "
                                . " tenant_id = '" . 
$this->db_boei->f('leietaker_id') . "',"
                                . " category = '" . 
$this->db_boei->f('formaal_id') . "',"
-                               . " etasje = '" . 
utf8_encode($this->db_boei->f('etasje')) . "',"
+                               . " etasje = '" . 
$this->bocommon->ascii2utf($this->db_boei->f('etasje')) . "',"
                                . " street_id = '" . 
$this->db_boei->f('gateadresse_id') . "',"
-                               . " street_number = '" . 
utf8_encode($this->db_boei->f('gatenr')) . "',"
+                               . " street_number = '" . 
$this->bocommon->ascii2utf($this->db_boei->f('gatenr')) . "',"
                                . " driftsstatus_id = '" . 
$this->db_boei->f('driftsstatus_id') . "',"
                                . " boareal = '" . $this->db_boei->f('boareal') 
. "'"
                                . " WHERE  loc1 = '" . 
$this->db_boei->f('objekt_id') . "'  AND  loc4= '" . 
$this->db_boei->f('leie_id') . "'";
@@ -699,7 +713,7 @@
                        while ($this->db_boei->next_record())
                        {
                                $sql2_utf = " UPDATE fm_location1 SET "
-                               . " loc1_name = '" . 
utf8_encode($this->db_boei->f('navn')) . "',"
+                               . " loc1_name = '" . 
$this->bocommon->ascii2utf($this->db_boei->f('navn')) . "',"
                                . " sum_boa = '" . $this->db_boei->f('sum_boa') 
. "',"
                                . " ant_leieobjekt = '" . 
$this->db_boei->f('ant_leieobjekt') . "',"
                                . " part_of_town_id = '" . 
$this->db_boei->f('bydel_id') . "',"
@@ -746,7 +760,7 @@
                        while ($this->db_boei->next_record())
                        {
                                $sql2_utf = " UPDATE fm_location2 SET "
-                               . " loc2_name = '" . 
utf8_encode($this->db_boei->f('byggnavn')) . "',"
+                               . " loc2_name = '" . 
$this->bocommon->ascii2utf($this->db_boei->f('byggnavn')) . "',"
                                . " sum_boa = '" . $this->db_boei->f('sum_boa') 
. "',"
                                . " ant_leieobjekt = '" . 
$this->db_boei->f('ant_leieobjekt') . "'"
                                . " WHERE  loc1 = '" . 
$this->db_boei->f('objekt_id') . "'  AND  loc2= '" . 
$this->db_boei->f('bygg_id') . "'";
@@ -789,7 +803,7 @@
                        while ($this->db_boei->next_record())
                        {
                                $sql2_utf = " UPDATE fm_location3 SET "
-                               . " loc3_name = '" . 
utf8_encode($this->db_boei->f('beskrivelse')) . "',"
+                               . " loc3_name = '" . 
$this->bocommon->ascii2utf($this->db_boei->f('beskrivelse')) . "',"
                                . " sum_boa = '" . $this->db_boei->f('sum_boa') 
. "',"
                                . " ant_leieobjekt = '" . 
$this->db_boei->f('ant_leieobjekt') . "'"
                                . " WHERE  loc1 = '" . 
$this->db_boei->f('objekt_id') . "'  AND  loc2= '" . 
$this->db_boei->f('bygg_id') . "'  AND  loc3= '" . 
$this->db_boei->f('seksjons_id') . "'";




reply via email to

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