Esempio n. 1
0
 public function actionLinet2Import()
 {
     $model = new FormLinet2Import();
     if (isset($_POST['FormLinet2Import'])) {
         $configPath = Yii::app()->user->settings["company.path"];
         $file = Company::getFilePath() . "linet2.bak";
         $model->file = $_POST['FormLinet2Import']['file'];
         $model->file = CUploadedFile::getInstance($model, 'file');
         if ($model->file === null) {
             throw new CHttpException(501, Yii::t('app', 'Error in request.'));
         }
         //no file
         if ($model->file->saveAs($file)) {
             $model->file = $file;
             $model->import();
             //$model->read();
         }
     }
     $this->render('linet2Import', array('model' => $model));
     Yii::app()->end();
 }
Esempio n. 2
0
 public static function getCertFilePath($id = null)
 {
     if ($id == null) {
         $id = Yii::app()->user->id;
     }
     $user = User::model()->findByPk($id);
     if ($user !== null) {
         return Company::getFilePath() . "cert/" . $id . ".p12";
     }
 }
Esempio n. 3
0
 function import($account)
 {
     $file = CUploadedFile::getInstance($this, 'file');
     //echo 'not file';
     if (is_object($file) && get_class($file) === 'CUploadedFile') {
         //echo 'is file';
         $filename = Company::getFilePath() . "TNout";
         //x
         if ($file->saveAs($filename)) {
             //read file...
             $fp = fopen($filename, 'r');
             return $this->readFile($fp, $account);
         } else {
             throw new CHttpException(500, Yii('app', 'cannot save bankbook'));
         }
     }
 }
Esempio n. 4
0
 public function getFullPath()
 {
     return Company::getFilePath() . $this->path;
 }