phpgroupware-cvs
[Top][All Lists]
Advanced

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

[Phpgroupware-cvs] property/export/GABNr, 1.1.1.3


From: nomail
Subject: [Phpgroupware-cvs] property/export/GABNr, 1.1.1.3
Date: Fri, 21 May 2004 16:22:44 -0000

Update of /property/export
Modified Files:
        Branch: 
          GABNr

date: 2004/04/23 21:26:32;  author: sigurdne;  state: Exp;  lines: +140 -140

Log Message:
no message
=====================================================================
Index: property/export/GABNr
diff -u property/export/GABNr:1.1.1.2 property/export/GABNr:1.1.1.3
--- property/export/GABNr:1.1.1.2       Fri Apr 23 20:27:19 2004
+++ property/export/GABNr       Fri Apr 23 21:26:32 2004
@@ -1,140 +1,140 @@
-<?php
-
-       class export_conv
-       {
-               function export_conv()
-               {
-
-                       $this->currentapp       = 
$GLOBALS['phpgw_info']['flags']['currentapp'];
-                       $this->soXport          = 
CreateObject($this->currentapp.'.soXport');   
-                       $this->$config          = 
CreateObject('phpgwapi.config','property');
-                       $this->socommon         = 
CreateObject($this->currentapp.'.socommon');
-                       $this->solocation       = 
CreateObject($this->currentapp.'.solocation');
-                       
-                       $this->$config->read_repository();
-                       
-                       $this->db = $GLOBALS['phpgw']->db;
-
-                       $this->socommon                 = 
CreateObject($this->currentapp.'.socommon');
-
-                       $this->join                     = $this->socommon->join;
-
-               }
-
-               function overfor($download)
-               {
-                       //Generer batch ID
-                       $batchid = $this->soXport->next_batchid();
-               
-                       $receipt['message'][]= array('msg' => 
$this->OverforGAB($batchid,$download));
-
-                       return $receipt;
-               }               
-               
-               
-               function LagFilnavn ($batchid)
-               {       
-                       $fil_katalog = 
$this->$config->config_data['export_path'];
-                       //Beregn løpenr
-                       $StartLopeNr = ($batchid % 30) + 70;
-                       $LopeNr = $StartLopeNr;
-               
-                       do
-                       {
-                               //Konstruer filnavn
-                               $Filnavn = $fil_katalog . '/GABNr'. 
sprintf("%2d",$LopeNr) . '10.TXT';
-               
-                               //Sjekk om filen eksisterer
-                               If (!file_exists($Filnavn))
-                               {
-                                       return $Filnavn;
-                               }
-               
-                               //Genererer nytt løpenr
-                               $batchid = $batchid + 1;
-                               $LopeNr = ($batchid % 30) + 70;
-                       }
-                       while  ($LopeNr != $StartLopeNr);
-               
-                       //Ingen løpenr er ledige, gi feilmelding
-                       return False;
-               }
-               
-               function OverforGAB($batchid,$download)
-               {
-                       //Bestem filnavn
-                       
-                       $Filnavn = $this->LagFilnavn($batchid);
-                       if (!$Filnavn)
-                       {
-                               $message='LagFilnavn'.lang('Alle løpenr for 
filnavn er i bruk!');
-                               return $message;
-                       }
-
-                       //Test om filen kan opprettes og skrives til
-                       if (@fopen($Filnavn, "wb"))
-                       {
-                               unlink($Filnavn);
-                       }
-                       else
-                       {
-                               $message='kan ikke lagre til fil: '. $Filnavn;
-                               return $message;
-                       }
-                       
-                       //Velg ut alle GABNr som skal overføres
-               
-                       $sql = "SELECT gab_id,loc1 FROM fm_gab_location GROUP 
BY gab_id,loc1 order by gab_id asc";
-
-                       $this->db->query($sql,__LINE__,__FILE__);
-
-                       while ($this->db->next_record())
-                       {
-                               $gab_list[] = array
-                               (
-                                       'gab_id' => $this->db->f('gab_id'),
-                                       'address' => $this->db->f('address'),
-                                       'location_code' => $this->db->f('loc1')
-                                       );
-                       }                                                       
                
-
-                       $cols_extra=array(0=>'loc1_name');
-                       
-                       $gab_count = count($gab_list);
-                       
-                       for ($i=0;$i<$gab_count;$i++)
-                       {
-                               
$location_data=$this->solocation->read_single($gab_list[$i]['location_code']);
-                               for ($j=0;$j<count($cols_extra);$j++)
-                               {
-                                       $gab_list[$i][$cols_extra[$j]] = 
$location_data[$cols_extra[$j]];
-                               }
-
-                       }
-
-                       $buffer = 'GABNr'. '    ' .'Objekt'."\r\n";
-
-                       for ($k=0;$k<$gab_count;$k++)
-                       {                               
-                               $buffer .=substr($gab_list[$k]['gab_id'],-20). 
'        ' .$gab_list[$k]['loc1_name']."\r\n";
-                               
-                               $antall = $antall + 1;
-                       }
-               
-//                     $buffer .= 'antall:'.'  '.$antall;
-
-                       if ($download=='on')
-                       {
-                               $message = 'Antall GABNr overført:'.$antall . ' 
,Til fil: ' . $Filnavn;
-                               $fp = fopen($Filnavn, "wb");
-                               fwrite($fp,$buffer);
-                               fclose($fp);
-                       }
-                       else
-                       {
-                               $message = $buffer;
-                       }
-                       return $message;
-               }
-       }
-?>
+<?php
+
+       class export_conv
+       {
+               function export_conv()
+               {
+
+                       $this->currentapp       = 
$GLOBALS['phpgw_info']['flags']['currentapp'];
+                       $this->soXport          = 
CreateObject($this->currentapp.'.soXport');   
+                       $this->$config          = 
CreateObject('phpgwapi.config','property');
+                       $this->socommon         = 
CreateObject($this->currentapp.'.socommon');
+                       $this->solocation       = 
CreateObject($this->currentapp.'.solocation');
+                       
+                       $this->$config->read_repository();
+                       
+                       $this->db = $GLOBALS['phpgw']->db;
+
+                       $this->socommon                 = 
CreateObject($this->currentapp.'.socommon');
+
+                       $this->join                     = $this->socommon->join;
+
+               }
+
+               function overfor($download)
+               {
+                       //Generer batch ID
+                       $batchid = $this->soXport->next_batchid();
+               
+                       $receipt['message'][]= array('msg' => 
$this->OverforGAB($batchid,$download));
+
+                       return $receipt;
+               }               
+               
+               
+               function LagFilnavn ($batchid)
+               {       
+                       $fil_katalog = 
$this->$config->config_data['export_path'];
+                       //Beregn løpenr
+                       $StartLopeNr = ($batchid % 30) + 70;
+                       $LopeNr = $StartLopeNr;
+               
+                       do
+                       {
+                               //Konstruer filnavn
+                               $Filnavn = $fil_katalog . '/GABNr'. 
sprintf("%2d",$LopeNr) . '10.TXT';
+               
+                               //Sjekk om filen eksisterer
+                               If (!file_exists($Filnavn))
+                               {
+                                       return $Filnavn;
+                               }
+               
+                               //Genererer nytt løpenr
+                               $batchid = $batchid + 1;
+                               $LopeNr = ($batchid % 30) + 70;
+                       }
+                       while  ($LopeNr != $StartLopeNr);
+               
+                       //Ingen løpenr er ledige, gi feilmelding
+                       return False;
+               }
+               
+               function OverforGAB($batchid,$download)
+               {
+                       //Bestem filnavn
+                       
+                       $Filnavn = $this->LagFilnavn($batchid);
+                       if (!$Filnavn)
+                       {
+                               $message='LagFilnavn'.lang('Alle løpenr for 
filnavn er i bruk!');
+                               return $message;
+                       }
+
+                       //Test om filen kan opprettes og skrives til
+                       if (@fopen($Filnavn, "wb"))
+                       {
+                               unlink($Filnavn);
+                       }
+                       else
+                       {
+                               $message='kan ikke lagre til fil: '. $Filnavn;
+                               return $message;
+                       }
+                       
+                       //Velg ut alle GABNr som skal overføres
+               
+                       $sql = "SELECT gab_id,loc1 FROM fm_gab_location GROUP 
BY gab_id,loc1 order by gab_id asc";
+
+                       $this->db->query($sql,__LINE__,__FILE__);
+
+                       while ($this->db->next_record())
+                       {
+                               $gab_list[] = array
+                               (
+                                       'gab_id' => $this->db->f('gab_id'),
+                                       'address' => $this->db->f('address'),
+                                       'location_code' => $this->db->f('loc1')
+                                       );
+                       }                                                       
                
+
+                       $cols_extra=array(0=>'loc1_name');
+                       
+                       $gab_count = count($gab_list);
+                       
+                       for ($i=0;$i<$gab_count;$i++)
+                       {
+                               
$location_data=$this->solocation->read_single($gab_list[$i]['location_code']);
+                               for ($j=0;$j<count($cols_extra);$j++)
+                               {
+                                       $gab_list[$i][$cols_extra[$j]] = 
$location_data[$cols_extra[$j]];
+                               }
+
+                       }
+
+                       $buffer = 'GABNr'. '    ' .'Objekt'."\r\n";
+
+                       for ($k=0;$k<$gab_count;$k++)
+                       {                               
+                               $buffer .=substr($gab_list[$k]['gab_id'],-20). 
'        ' .$gab_list[$k]['loc1_name']."\r\n";
+                               
+                               $antall = $antall + 1;
+                       }
+               
+//                     $buffer .= 'antall:'.'  '.$antall;
+
+                       if ($download=='on')
+                       {
+                               $message = 'Antall GABNr overført:'.$antall . ' 
,Til fil: ' . $Filnavn;
+                               $fp = fopen($Filnavn, "wb");
+                               fwrite($fp,$buffer);
+                               fclose($fp);
+                       }
+                       else
+                       {
+                               $message = $buffer;
+                       }
+                       return $message;
+               }
+       }
+?>




reply via email to

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