add transfer-moneymovement

This commit is contained in:
2015-10-19 17:22:50 +02:00
parent ab40f937a3
commit 71384b6453
12 changed files with 341 additions and 71 deletions

View File

@@ -8,6 +8,7 @@ use frontend\models\TransferSearch;
use yii\web\Controller;
use yii\web\NotFoundHttpException;
use yii\filters\VerbFilter;
use frontend\models\TransferMoneyMovementSearch;
/**
* TransferController implements the CRUD actions for Transfer model.
@@ -30,12 +31,12 @@ class TransferController extends Controller
* Lists all Transfer models.
* @return mixed
*/
public function actionIndex()
public function actionMoneyMovementIndex()
{
$searchModel = new TransferSearch();
$searchModel = new TransferMoneyMovementSearch();
$dataProvider = $searchModel->search(Yii::$app->request->queryParams);
return $this->render('index', [
return $this->render('money_movement/money_movement_index', [
'searchModel' => $searchModel,
'dataProvider' => $dataProvider,
]);
@@ -58,50 +59,22 @@ class TransferController extends Controller
* If creation is successful, the browser will be redirected to the 'view' page.
* @return mixed
*/
public function actionCreate()
public function actionMoneyMovementCreate()
{
$model = new Transfer();
$model->type = Transfer::TYPE_MONEY_MOVEMENT_OUT;
$model->direction = Transfer::DIRECTION_OUT;
if ($model->load(Yii::$app->request->post()) && $model->save()) {
return $this->redirect(['view', 'id' => $model->id_transfer]);
} else {
return $this->render('create', [
return $this->render('money_movement/create_money_movement', [
'model' => $model,
]);
}
}
/**
* Updates an existing Transfer model.
* If update is successful, the browser will be redirected to the 'view' page.
* @param integer $id
* @return mixed
*/
public function actionUpdate($id)
{
$model = $this->findModel($id);
if ($model->load(Yii::$app->request->post()) && $model->save()) {
return $this->redirect(['view', 'id' => $model->id_transfer]);
} else {
return $this->render('update', [
'model' => $model,
]);
}
}
/**
* Deletes an existing Transfer model.
* If deletion is successful, the browser will be redirected to the 'index' page.
* @param integer $id
* @return mixed
*/
public function actionDelete($id)
{
$this->findModel($id)->delete();
return $this->redirect(['index']);
}
/**
* Finds the Transfer model based on its primary key value.
@@ -118,4 +91,37 @@ class TransferController extends Controller
throw new NotFoundHttpException('The requested page does not exist.');
}
}
/**
* Updates an existing Transfer model.
* If update is successful, the browser will be redirected to the 'view' page.
* @param integer $id
* @return mixed
public function actionUpdate($id)
{
$model = $this->findModel($id);
if ($model->load(Yii::$app->request->post()) && $model->save()) {
return $this->redirect(['view', 'id' => $model->id_transfer]);
} else {
return $this->render('update', [
'model' => $model,
]);
}
}
*/
/**
* Deletes an existing Transfer model.
* If deletion is successful, the browser will be redirected to the 'index' page.
* @param integer $id
* @return mixed
public function actionDelete($id)
{
$this->findModel($id)->delete();
return $this->redirect(['index']);
}
*/
}