add feature clear card

This commit is contained in:
2016-04-03 10:44:12 +02:00
parent ee4ae54e6f
commit 5ff974c717
12 changed files with 108 additions and 56 deletions

View File

@@ -14,6 +14,7 @@ use yii\web\UploadedFile;
use common\components\Helper;
use backend\models\CardInsertForm;
use common\models\Ticket;
use frontend\components\HtmlHelper;
/**
* CardController implements the CRUD actions for Card model.
@@ -25,6 +26,16 @@ class CardController extends \backend\controllers\BackendController {
'class' => \yii\filters\AccessControl::className (),
'rules' => [
// allow authenticated users
[
'actions' => [
'clear',
],
'allow' => true,
'roles' => [
'admin'
]
],
[
'actions' => [
'create',
@@ -40,7 +51,8 @@ class CardController extends \backend\controllers\BackendController {
'roles' => [
'@'
]
]
] ,
]
// everything else is denied
@@ -48,6 +60,23 @@ class CardController extends \backend\controllers\BackendController {
];
}
public function actionClear($id){
$model = $this->findModel ( $id );
$customer = $model->customer;
$customer->id_customer_card = null;
$customer->save(false);
Ticket::updateAll(['id_card' => null],['id_card' => $model->id_card]);
Helper::flash('success', "Vendég törölve a kártyáról");
$this->redirect(['card/update','id' =>$id]);
}
/**
* Lists all Card models.
*

View File

@@ -33,7 +33,7 @@ class KeyController extends Controller {
'rules' => [
// allow authenticated users
[
'actions' => ['create','index','view','update','import'],
'actions' => ['create','index','view','update','import','index-customer'],
'allow' => true,
'roles' => ['admin','employee','reception'],
],

View File

@@ -137,7 +137,7 @@ class TicketController extends \backend\controllers\BackendController {
$searchModel = new TicketSearchCustomer(['customer' => $customer]);
$searchModel->id_card = $customer->id_customer_card;
$dataProvider = $searchModel->search ( Yii::$app->request->queryParams );
$searchModel->searchTotals ();
//$searchModel->searchTotals ();
$searchModel->users = User::read ();
$searchModel->accounts = Account::read ();

View File

@@ -63,7 +63,6 @@ class TransferController extends \backend\controllers\BackendController
$dataProvider = $searchModel->search(Yii::$app->request->queryParams);
echo "output:".$searchModel->output;
if ( $searchModel->output =='pdf'){
$this->downloadPaymentLater($dataProvider);