add transfer unstorno
This commit is contained in:
parent
1d95d37373
commit
01ada90e8c
@ -17,6 +17,7 @@ use common\models\Product;
|
||||
use backend\models\TransferListUserGroupedSearch;
|
||||
use backend\models\TransferLaterSearch;
|
||||
use yii\helpers\Url;
|
||||
use common\components\Helper;
|
||||
|
||||
/**
|
||||
* TransferController implements the CRUD actions for Transfer model.
|
||||
@ -26,6 +27,14 @@ class TransferController extends \backend\controllers\BackendController
|
||||
public function behaviors()
|
||||
{
|
||||
return [
|
||||
'verbs' => [
|
||||
'class' => VerbFilter::className (),
|
||||
'actions' => [
|
||||
'unstorno' => [
|
||||
'post'
|
||||
]
|
||||
]
|
||||
],
|
||||
'access' => [
|
||||
'class' => \yii\filters\AccessControl::className(),
|
||||
'rules' => [
|
||||
@ -38,10 +47,17 @@ class TransferController extends \backend\controllers\BackendController
|
||||
"sale",
|
||||
"sale-pdf" ,
|
||||
'list-user-grouped',
|
||||
'payment-later'],
|
||||
'payment-later'
|
||||
],
|
||||
'allow' => true,
|
||||
'roles' => ['admin','employee','reception'],
|
||||
],
|
||||
[
|
||||
'actions' => [ 'unstorno',
|
||||
],
|
||||
'allow' => true,
|
||||
'roles' => ['admin' ],
|
||||
],
|
||||
// everything else is denied
|
||||
],
|
||||
],
|
||||
@ -296,6 +312,18 @@ class TransferController extends \backend\controllers\BackendController
|
||||
'model' => $this->findModel($id),
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
public function actionUnstorno($id)
|
||||
{
|
||||
$model = $this->findModel($id);
|
||||
|
||||
$model->unstorono();
|
||||
|
||||
Helper::flash("success", "Bérlet visszaállítva");
|
||||
|
||||
return $this->redirect( ['view' ,'id' => $model->id_transfer]);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@ -39,10 +39,10 @@ class TicketSearch extends Ticket
|
||||
public function rules()
|
||||
{
|
||||
return [
|
||||
[[ 'id_ticket', 'id_user', 'id_ticket_type', 'id_account','status'], 'integer'],
|
||||
[[ 'id_ticket', 'id_user', 'id_ticket_type', 'id_account','status'], 'integer'],
|
||||
[[ 'start', ], 'date' , 'timestampAttribute' => 'timestampStart' ,'timestampAttributeFormat' => 'yyyy-MM-dd' ],
|
||||
[[ 'end' , ], 'date' , 'timestampAttribute' => 'timestampEnd' ,'timestampAttributeFormat' => 'yyyy-MM-dd' ],
|
||||
[['valid_in_interval','created_in_interval','expire_in_interval'],'boolean'] ,
|
||||
[[ 'valid_in_interval','created_in_interval','expire_in_interval'],'boolean'] ,
|
||||
|
||||
];
|
||||
}
|
||||
|
||||
@ -34,6 +34,8 @@ class TransferSearch extends Transfer
|
||||
public $types;
|
||||
public $totals;
|
||||
|
||||
public $customer_name;
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
@ -41,6 +43,7 @@ class TransferSearch extends Transfer
|
||||
{
|
||||
return [
|
||||
[[ 'id_account','id_user', 'type','status','payment_method'], 'integer'],
|
||||
[['customer_name'],'safe'],
|
||||
// [[ 'searchObjectName' ], 'string'],
|
||||
// [[ 'start', ], 'date' , 'timestampAttribute' => 'timestampStart' ,'timestampAttributeFormat' => 'yyyy-MM-dd' ],
|
||||
// [[ 'end' , ], 'date' , 'timestampAttribute' => 'timestampEnd' ,'timestampAttributeFormat' => 'yyyy-MM-dd' ],
|
||||
@ -149,6 +152,7 @@ class TransferSearch extends Transfer
|
||||
'transfer.type' => $this->type,
|
||||
'transfer.status' => $this->status,
|
||||
'transfer.payment_method' => $this->payment_method,
|
||||
'customer.name' => $this->customer_name
|
||||
]);
|
||||
|
||||
$query->andFilterWhere(['in' ,'transfer.type', $this->types]);
|
||||
|
||||
@ -57,6 +57,9 @@ use kartik\widgets\DateTimePicker;
|
||||
<div class='col-md-3'>
|
||||
<?= $form->field($model, 'payment_method')->dropDownList( ['' => "Mind"] + Transfer::paymentMethods() ) ?>
|
||||
</div>
|
||||
<div class='col-md-3'>
|
||||
<?= $form->field($model, 'customer_name')->label("Vendég") ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
|
||||
@ -1,56 +1,61 @@
|
||||
<?php
|
||||
|
||||
use yii\helpers\Html;
|
||||
use yii\widgets\DetailView;
|
||||
use common\components\RoleDefinition;
|
||||
use common\models\Ticket;
|
||||
use common\models\Transfer;
|
||||
|
||||
/* @var $this yii\web\View */
|
||||
/* @var $model common\models\Transfer */
|
||||
|
||||
$this->title = $model->id_transfer;
|
||||
$this->params['breadcrumbs'][] = ['label' => Yii::t('frontend/transfer', 'Transfers'), 'url' => ['index']];
|
||||
$this->params['breadcrumbs'][] = $this->title;
|
||||
$this->params ['breadcrumbs'] [] = [
|
||||
'label' => Yii::t ( 'frontend/transfer', 'Transfers' ),
|
||||
'url' => [
|
||||
'index'
|
||||
]
|
||||
];
|
||||
$this->params ['breadcrumbs'] [] = $this->title;
|
||||
?>
|
||||
<div class="transfer-view">
|
||||
|
||||
<h1><?= Html::encode($this->title) ?></h1>
|
||||
|
||||
<?= DetailView::widget([
|
||||
'model' => $model,
|
||||
'attributes' => [
|
||||
[
|
||||
'attribute' => 'id_transfer',
|
||||
],
|
||||
[
|
||||
'attribute' => 'id_account',
|
||||
'value' => $model->accountName
|
||||
],
|
||||
[
|
||||
'attribute' => 'type',
|
||||
'value' => $model->transferTypeName,
|
||||
],
|
||||
[
|
||||
'attribute' => 'id_object',
|
||||
'value' => $model->objectName,
|
||||
],
|
||||
[
|
||||
'attribute' => 'id_user',
|
||||
'value' => $model->userName,
|
||||
],
|
||||
[
|
||||
'attribute' => 'id_discount',
|
||||
'value' => $model->discountName,
|
||||
],
|
||||
[
|
||||
'attribute' => 'payment_method',
|
||||
'value' => $model->paymentMethodName,
|
||||
],
|
||||
'item_price',
|
||||
'count',
|
||||
'money',
|
||||
'comment',
|
||||
'created_at',
|
||||
'paid_at',
|
||||
],
|
||||
]) ?>
|
||||
<h1><?= Html::encode($this->title) ?></h1>
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
<?=DetailView::widget (
|
||||
[ 'model' => $model,
|
||||
'attributes' => [
|
||||
[ 'attribute' => 'id_transfer' ],
|
||||
[ 'attribute' => 'id_account','value' => $model->accountName ],
|
||||
[ 'attribute' => 'type','value' => $model->transferTypeName ],
|
||||
[ 'attribute' => 'id_object','value' => $model->objectName ],
|
||||
[ 'attribute' => 'id_user','value' => $model->userName ],
|
||||
[ 'attribute' => 'id_discount','value' => $model->discountName ],
|
||||
[ 'attribute' => 'payment_method','value' => $model->paymentMethodName ],
|
||||
[ 'attribute' => 'status','value' => $model->statusName ],
|
||||
'item_price',
|
||||
'count',
|
||||
'money',
|
||||
'comment',
|
||||
'created_at',
|
||||
'paid_at' ] ] )?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<?php
|
||||
|
||||
if (RoleDefinition::isAdmin ()) {
|
||||
if ($model->status == Transfer::STATUS_STORNO) {
|
||||
echo Html::a ( "Bérlet fizetetlennek jelölése és vásárló kosarába helyezése", [
|
||||
'transfer/unstorno',
|
||||
'id' => $model->id_transfer
|
||||
], [
|
||||
'class' => 'btn btn-danger',
|
||||
'data-confirm' => "Figyelem, a bérlet fizetetlennek lesz jelölve !!",
|
||||
'data-method' => 'post'
|
||||
] );
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
@ -1,3 +1,6 @@
|
||||
-0.0.64
|
||||
- admin add unstorno ticket
|
||||
- admin transfer search by customer name
|
||||
-0.0.63
|
||||
- admin edit ticket date
|
||||
-0.0.62
|
||||
|
||||
@ -4,7 +4,7 @@ return [
|
||||
'supportEmail' => 'rocho02@gmail.com',
|
||||
'infoEmail' => 'info@rocho-net.hu',
|
||||
'user.passwordResetTokenExpire' => 3600,
|
||||
'version' => 'v0.0.63',
|
||||
'version' => 'v0.0.64',
|
||||
'company' => 'movar',//gyor
|
||||
'company_name' => "Freimann Kft.",
|
||||
'product_visiblity' => 'account',// on reception which products to display. account or global
|
||||
|
||||
@ -960,6 +960,36 @@ class Transfer extends \common\models\BaseFitnessActiveRecord {
|
||||
ShoppingCart::deleteAll(['id_transfer' => $this->id_transfer]);
|
||||
UserSoldItem::deleteAll(['id_transfer' => $this->id_transfer]);
|
||||
}
|
||||
|
||||
public function unstorono(){
|
||||
|
||||
if ($this->type != Transfer::TYPE_TICKET) {
|
||||
throw new NotAcceptableHttpException("Csak bérletet lehet visszaállítani");
|
||||
}
|
||||
|
||||
$this->status = Transfer::STATUS_NOT_PAID;
|
||||
$this->paid_at = null;
|
||||
$this->paid_by = null;
|
||||
$this->save ( false );
|
||||
|
||||
$ticket = $this->ticket;
|
||||
$ticket->status = Ticket::STATUS_ACTIVE;
|
||||
|
||||
$ticket->save ( false );
|
||||
|
||||
TicketInstallmentRequest::updateAll ( [
|
||||
'status' => TicketInstallmentRequest::$STATUS_ACCEPTED_MANUAL
|
||||
], [
|
||||
'id_ticket' => $ticket->id_ticket
|
||||
] );
|
||||
|
||||
|
||||
$item = new ShoppingCart();
|
||||
$item->id_customer = $this->id_customer;
|
||||
$item->id_transfer = $this->id_transfer;
|
||||
$item->save(false);
|
||||
}
|
||||
|
||||
public function payout($id_account = null) {
|
||||
|
||||
if ($this->status != Transfer::STATUS_NOT_PAID) {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user