Example #1
0
 public function readIni()
 {
     //new company
     //
     //
     //get perm from ini
     $encoding = "windows-1255";
     //$encoding="ibm862";
     $ini = $this->iniFile;
     if ($fp = fopen($ini, 'r')) {
         while ($line = fgets($fp)) {
             @($line = iconv($encoding, "UTF-8//IGNORE", $line));
             //$line=utf8_encode($line);
             $type = substr($line, 0, 4);
             //$obj=$this->readline($line,$type);
             $obj = true;
             if (!$obj) {
                 //$suc[$type]--;
             } else {
                 //foreach ($obj as &$value)
                 //	if ($encoding=="ibm862")
                 //		$value = iconv("ISO-8859-8", "UTF-8", hebrev(iconv("UTF-8", "ISO-8859-8", $value)));
                 if ($type == 'A000') {
                     //Acc Haeder
                     /* Account Import */
                     $comp = new Company();
                     $comp->string = Yii::$app->dbMain->dsn;
                     $comp->user = Yii::$app->dbMain->username;
                     $comp->password = Yii::$app->dbMain->password;
                     /*
                                               $obj["type"]=(int)$obj["type"]+50;
                                               if(isset($accTypeIndex[$obj["type"]]))
                                               $accTypeIndex[$obj["type"]]=$accTypeIndex[$obj["type"]].",".$obj["name"];
                                               else
                                               $accTypeIndex[$obj["type"]]=$obj["typedesc"].":".$obj["name"];
                                               unset($obj["typedesc"]); */
                     //1405 acc type code
                     //1406 acc type name
                     //print_r($obj);//Yii::$app->end();
                     //$comp->createDb();
                     $comp->save();
                     $this->companyId = $comp->id;
                     $comp->readLine($line, $type);
                     $this->clearCompany();
                     //$accIndex[$obj["id"]]=$acc->save();
                     //get new acc index save old
                     //$this->companyId=$comp->id;
                     //echo $this->companyId;
                     //Yii::$app->end();
                     unset($comp);
                 }
             }
         }
     }
 }