Beispiel #1
0
 public static function getCertFilePath($id = null)
 {
     if ($id == null) {
         $id = \app\helpers\Linet3Helper::getUserId();
     }
     $user = User::findOne($id);
     if ($user !== null) {
         return Company::getFilePath() . "cert/" . $id . ".p12";
     }
 }
Beispiel #2
0
 public function getFullPath()
 {
     return Company::getFilePath() . $this->path;
 }
Beispiel #3
0
 public function actionLinet2import()
 {
     $model = new FormLinet2Import();
     if (isset($_POST['FormLinet2Import'])) {
         $configPath = \app\helpers\Linet3Helper::getSetting("company.path");
         $file = Company::getFilePath() . "linet2.bak";
         $model->file = $_POST['FormLinet2Import']['file'];
         $model->file = \yii\web\UploadedFile::getInstance($model, 'file');
         if ($model->file === null) {
             throw new \yii\web\HttpException(501, Yii::t('app', 'Error in request.'));
         }
         //no file
         if ($model->file->saveAs($file)) {
             $model->file = $file;
             $model->import();
             //$model->read();
         }
     }
     return $this->render('linet2Import', array('model' => $model));
     Yii::$app->end();
 }
Beispiel #4
0
 function import($account)
 {
     $file = \yii\web\UploadedFile::getInstance($this, 'file');
     //echo 'not file';
     if (is_object($file) && get_class($file) === 'yii\\web\\UploadedFile') {
         //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 \Exception(Yii('app', 'cannot save bankbook'));
         }
     }
 }