Finish detsta_part
This commit is contained in:
@@ -14,6 +14,7 @@ use yii\web\UploadedFile;
|
||||
use yii\data\ArrayDataProvider;
|
||||
use yii\db\Query;
|
||||
use yii\data\ActiveDataProvider;
|
||||
use common\models\MessageDetsta;
|
||||
|
||||
/**
|
||||
* UgiroController implements the CRUD actions for Ugiro model.
|
||||
@@ -97,6 +98,7 @@ class UgiroController extends Controller {
|
||||
'koteg' => $model
|
||||
] );
|
||||
$processor->run ();
|
||||
$this->redirect(['view', 'id' => $model->id_ugiro]);
|
||||
} else {
|
||||
\Yii::$app->session->setFlash ( 'danger', 'Nem lehet futtatni a fájlt' );
|
||||
\Yii::error ( "a koteg státusza nem STATUS_RECIEVED. A koteg azonosíótja:" . $model->id_ugiro );
|
||||
@@ -111,8 +113,19 @@ class UgiroController extends Controller {
|
||||
}
|
||||
}
|
||||
|
||||
$query = MessageDetsta::find();
|
||||
$query->andWhere(['id_ugiro' => $model->id_ugiro]);
|
||||
$query->orderBy([ 'created_at' => SORT_ASC ]);
|
||||
|
||||
$detstaDp = new ActiveDataProvider([
|
||||
'query' => $query,
|
||||
'pagination' => false,
|
||||
'sort' => false
|
||||
]);
|
||||
|
||||
return $this->render ( 'view', [
|
||||
'model' => $this->findModel ( $id )
|
||||
'model' => $this->findModel ( $id ) ,
|
||||
'detstaDp' => $detstaDp
|
||||
] );
|
||||
}
|
||||
protected function downloadUgiro($model) {
|
||||
|
||||
@@ -6,6 +6,8 @@ use yii\base\Model;
|
||||
use yii\web\UploadedFile;
|
||||
use common\components\giro\GiroDETSTA;
|
||||
use common\models\Ugiro;
|
||||
use common\components\DetStatProcessor;
|
||||
use common\components\Helper;
|
||||
|
||||
class DestaUploadForm extends Model
|
||||
{
|
||||
@@ -41,26 +43,62 @@ class DestaUploadForm extends Model
|
||||
$this->koteg = $koteg;
|
||||
if (!isset($koteg)){
|
||||
$this->addError($attribute,"Nincs ilyen köteg! ( Datum: $datum, Sorszam: $number )");
|
||||
}else{
|
||||
if ( $koteg->status != Ugiro::$STATUS_SENT ){
|
||||
$idKoteg = $this->koteg->id_ugiro;
|
||||
$this->addError($attribute,"A köteg detsta fájl-ja már fel van töltve !( Köteg azonosító: $idKoteg )");
|
||||
}
|
||||
}
|
||||
|
||||
// else{
|
||||
// if ( $koteg->status != Ugiro::$STATUS_SENT ){
|
||||
// $idKoteg = $this->koteg->id_ugiro;
|
||||
// $this->addError($attribute,"A köteg detsta fájl-ja már fel van töltve !( Köteg azonosító: $idKoteg )");
|
||||
// }
|
||||
// }
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// public function saveMessageDetsta($filename){
|
||||
// $uzenetSzoveg = $this->readDetstaUzenet($filename);
|
||||
// $saver = new DetStaDBSave(
|
||||
// [
|
||||
// 'giroDETSTA' => $this->detstatUzenet,
|
||||
// 'koteg' => $this->koteg,
|
||||
// 'idUser' =>\Yii::$app->user->id
|
||||
// ]);
|
||||
// $saver->run();
|
||||
// }
|
||||
|
||||
|
||||
// public function readDetstaUzenet($filename){
|
||||
|
||||
// // $filename = \Yii::getAlias("@webroot") ."/" .$this->koteg->desta_path;
|
||||
// $content = file_get_contents($filename);
|
||||
// return GiroDETSTA::parse($content);
|
||||
|
||||
|
||||
|
||||
// }
|
||||
|
||||
|
||||
|
||||
public function upload()
|
||||
{
|
||||
if ($this->validate()) {
|
||||
$path = 'giro/valasz/' . $this->destaFile->baseName . '.' . $this->destaFile->extension;
|
||||
$this->destaFile->saveAs( $path );
|
||||
$this->koteg->desta_path = $path;
|
||||
$this->koteg->status = Ugiro::$STATUS_RECIEVED;
|
||||
$this->koteg->save(false);
|
||||
|
||||
|
||||
set_time_limit ( 1200 ); // 20 perc
|
||||
$processor = new DetStatProcessor( [
|
||||
'koteg' => $this->koteg,
|
||||
'path' => $path
|
||||
] );
|
||||
$processor->run ();
|
||||
|
||||
Helper::flash("success", "Detsta fájl feldolgozva!");
|
||||
|
||||
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
|
||||
@@ -5,6 +5,9 @@ use yii\widgets\DetailView;
|
||||
use yii\helpers\Url;
|
||||
use common\models\Ugiro;
|
||||
use yii\widgets\ActiveForm;
|
||||
use yii\grid\GridView;
|
||||
use yii\base\Widget;
|
||||
use yii\grid\ActionColumn;
|
||||
|
||||
/* @var $this yii\web\View */
|
||||
/* @var $model common\models\Ugiro */
|
||||
@@ -68,14 +71,14 @@ $attributes = [
|
||||
|
||||
|
||||
|
||||
if ( $model->status == Ugiro::$STATUS_RECIEVED || $model->status == Ugiro::$STATUS_FINISHED ){
|
||||
$attributes[] = [
|
||||
'attribute' => 'desta_path',
|
||||
'label' => 'Detsta Fájl',
|
||||
'value' => Html::a( "Letöltés" , Url::base() ."/". $model->desta_path , ['target' =>'_blank' ,'download' =>'CS-BESZED.' .$model->id_ugiro ] ),
|
||||
'format' => 'raw'
|
||||
];
|
||||
}
|
||||
// if ( $model->status == Ugiro::$STATUS_RECIEVED || $model->status == Ugiro::$STATUS_FINISHED ){
|
||||
// $attributes[] = [
|
||||
// 'attribute' => 'desta_path',
|
||||
// 'label' => 'Detsta Fájl',
|
||||
// 'value' => Html::a( "Letöltés" , Url::base() ."/". $model->desta_path , ['target' =>'_blank' ,'download' =>'CS-BESZED.' .$model->id_ugiro ] ),
|
||||
// 'format' => 'raw'
|
||||
// ];
|
||||
// }
|
||||
|
||||
?>
|
||||
|
||||
@@ -85,11 +88,41 @@ $attributes = [
|
||||
'attributes' => $attributes,
|
||||
]) ?>
|
||||
|
||||
|
||||
<h1>Detsta válaszok</h1>
|
||||
<?php
|
||||
echo GridView::widget(
|
||||
[
|
||||
'dataProvider' => $detstaDp,
|
||||
'columns' =>[
|
||||
[
|
||||
'attribute' => 'created_at',
|
||||
'label' => 'Létrehozva'
|
||||
],
|
||||
[
|
||||
'class' => ActionColumn::className() ,
|
||||
'template' =>'{view}',
|
||||
'urlCreator' => function ($action, $model, $key, $index){
|
||||
if ($action == 'view' ){
|
||||
return Url::toRoute(['message-detsta/view','id' => $model->id_message]);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
]
|
||||
]
|
||||
|
||||
]
|
||||
);
|
||||
|
||||
|
||||
|
||||
?>
|
||||
|
||||
</div>
|
||||
<div class="btns">
|
||||
<?php
|
||||
if ( $model->status == Ugiro::$STATUS_RECIEVED ){
|
||||
echo Html::a("DetSta Fájl Feldoglozás",['view', 'id' => $model->id_ugiro] ,['data-method' =>'post', 'class' => 'btn btn-danger']);
|
||||
//echo Html::a("DetSta Fájl Feldoglozás",['view', 'id' => $model->id_ugiro] ,['data-method' =>'post', 'class' => 'btn btn-danger']);
|
||||
}
|
||||
echo Html::a("Megbízások a kötegben",['ticket-installment-request/index', 'TicketInstallmentRequestSearch[id_ugiro]' => $model->id_ugiro] ,[ 'class' => 'btn btn-primary']);
|
||||
echo Html::a("PDF", Url::current(['output' => 'pdf']) ,[ 'class' => 'btn btn-primary']);
|
||||
|
||||
Reference in New Issue
Block a user